最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢(xún)
選擇下列產(chǎn)品馬上在線(xiàn)溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
HTML5+Webkit怎么實(shí)現(xiàn)樹(shù)葉飄落動(dòng)畫(huà)

這篇文章主要講解了“HTML5+Webkit怎么實(shí)現(xiàn)樹(shù)葉飄落動(dòng)畫(huà)”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“HTML5+Webkit怎么實(shí)現(xiàn)樹(shù)葉飄落動(dòng)畫(huà)”吧!

創(chuàng)新互聯(lián)建站主打移動(dòng)網(wǎng)站、成都做網(wǎng)站、網(wǎng)站建設(shè)、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)、網(wǎng)站改版、網(wǎng)絡(luò)推廣、網(wǎng)站維護(hù)、域名與空間、等互聯(lián)網(wǎng)信息服務(wù),為各行業(yè)提供服務(wù)。在技術(shù)實(shí)力的保障下,我們?yōu)榭蛻?hù)承諾穩(wěn)定,放心的服務(wù),根據(jù)網(wǎng)站的內(nèi)容與功能再?zèng)Q定采用什么樣的設(shè)計(jì)。最后,要實(shí)現(xiàn)符合網(wǎng)站需求的內(nèi)容、功能與設(shè)計(jì),我們還會(huì)規(guī)劃穩(wěn)定安全的技術(shù)方案做保障。

實(shí)現(xiàn)如圖所示的東西效果(落葉下落):

HTML5+Webkit怎么實(shí)現(xiàn)樹(shù)葉飄落動(dòng)畫(huà) 

html代碼:




    HTML5樹(shù)葉飄落動(dòng)畫(huà)
    
    
    
    


    
        
                     這是基于webkit的落葉動(dòng)畫(huà)         
    
   css代碼: body{     background-color: #4E4226; } #container {     position: relative;     height: 700px;     width: 500px;     margin: 10px auto;     overflow: hidden;     border: 4px solid #5C090A;     background: #4E4226 url('images/backgroundLeaves.jpg') no-repeat top left; } #leafContainer {     position: absolute;     width: 100%;     height: 100%; } #message{     position: absolute;     top: 160px;     width: 100%;     height: 300px;     background:transparent url('images/textBackground.png') repeat-x center;     color: #5C090A;     font-size: 220%;     font-family: 'Georgia';     text-align: center;     padding: 20px 10px;     -webkit-box-sizing: border-box;     -webkit-background-size: 100% 100%;     z-index: 1; } em {     font-weight: bold;     font-style: normal; } #leafContainer > div {     position: absolute;     width: 100px;     height: 100px;     -webkit-animation-iteration-count: infinite;     -webkit-animation-direction: normal;     -webkit-animation-timing-function: linear; } #leafContainer > div > img {      position: absolute;      width: 100px;      height: 100px;      -webkit-animation-iteration-count: infinite;      -webkit-animation-direction: alternate;      -webkit-animation-timing-function: ease-in-out;      -webkit-transform-origin: 50% -100%; } @-webkit-keyframes fade{     0%   { opacity: 1; }     95%  { opacity: 1; }     100% { opacity: 0; } } @-webkit-keyframes drop{     0%   { -webkit-transform: translate(0px, -50px); }     100% { -webkit-transform: translate(0px, 650px); } } @-webkit-keyframes clockwiseSpin{     0%   { -webkit-transform: rotate(-50deg); }     100% { -webkit-transform: rotate(50deg); } } @-webkit-keyframes counterclockwiseSpinAndFlip {     0%   { -webkit-transform: scale(-1, 1) rotate(50deg); }     100% { -webkit-transform: scale(-1, 1) rotate(-50deg); } } js代碼: const NUMBER_OF_LEAVES = 30; function init(){     var container = document.getElementById('leafContainer');     for (var i = 0; i < NUMBER_OF_LEAVES; i++) {         container.appendChild(createALeaf());     } } function randomInteger(low, high){     return low + Math.floor(Math.random() * (high - low)); } function randomFloat(low, high){     return low + Math.random() * (high - low); } function pixelValue(value){     return value + 'px'; } function durationValue(value){     return value + 's'; } function createALeaf(){     var leafDiv = document.createElement('div');     leafDiv.style.top = "-100px";     leafDiv.style.left = pixelValue(randomInteger(0, 500));     leafDiv.style.webkitAnimationName = 'fade, drop';     var fadeAndDropDuration = durationValue(randomFloat(5, 11));     leafDiv.style.webkitAnimationDuration = fadeAndDropDuration + ', ' + fadeAndDropDuration;     var leafDelay = durationValue(randomFloat(0, 5));     leafDiv.style.webkitAnimationDelay = leafDelay + ', ' + leafDelay;     var image = document.createElement('img');     image.src = 'images/realLeaf' + randomInteger(1, 5) + '.png';     var spinAnimationName = (Math.random() < 0.5) ? 'clockwiseSpin' : 'counterclockwiseSpinAndFlip';     image.style.webkitAnimationName = spinAnimationName;     var spinDuration = durationValue(randomFloat(4, 8));     image.style.webkitAnimationDuration = spinDuration;     leafDiv.appendChild(image);     return leafDiv; } window.addEventListener('load', init, false);

PS:下面看下html5 canvas處理連續(xù)幀圖片,下面的代碼基于IE8以上






Canvas Demo



    

感謝各位的閱讀,以上就是“HTML5+Webkit怎么實(shí)現(xiàn)樹(shù)葉飄落動(dòng)畫(huà)”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)HTML5+Webkit怎么實(shí)現(xiàn)樹(shù)葉飄落動(dòng)畫(huà)這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!


網(wǎng)站欄目:HTML5+Webkit怎么實(shí)現(xiàn)樹(shù)葉飄落動(dòng)畫(huà)
文章轉(zhuǎn)載:http://fisionsoft.com.cn/article/jgsodj.html