校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > 逼真的HTML5樹葉飄落動畫

逼真的HTML5樹葉飄落動畫

熱門標簽:南通數據外呼系統推廣 阜陽企業外呼系統 外呼系統電話怎么投訴 地圖標注位置能賺錢嗎 呼和浩特外呼電銷系統排名 外呼線穩定線路 pageadm實現地圖標注 申請400電話流程簡介 邢臺縣地圖標注app

這款HTML5樹葉飄落動畫是基于webkit內核的,也就是說要在webkit內核的瀏覽器上才能使用這款動畫。

源碼下載 演示地址

HTML代碼

XML/HTML Code復制內容到剪貼板
  1. <div id="container">  
  2.   <!-- The container is dynamically populated using the init function in leaves.js -->  
  3.   <!-- Its dimensions and position are defined using its id selector in leaves.css -->  
  4.   <div id="leafContainer"></div>  
  5.   <!-- its appearance, dimensions, and position are defined using its id selector in leaves.css -->  
  6.   <div id="message">  
  7.    <em>這是基于webkit的落葉動畫</em>  
  8.   </div>  
  9. </div>  

CSS代碼

CSS Code復制內容到剪貼板
  1. #container {   
  2.     positionrelative;   
  3.     height700px;   
  4.     width500px;   
  5.     margin10px auto;   
  6.     overflowhidden;   
  7.     border4px solid #5C090A;   
  8.     background#4E4226 url('images/backgroundLeaves.jpg'no-repeat top left;   
  9. }   
  10.   
  11. /* Defines the position and dimensions of the leafContainer div */  
  12. #leafContainer    
  13. {   
  14.     positionabsolute;   
  15.     width: 100%;   
  16.     height: 100%;   
  17. }   
  18.   
  19. /* Defines the appearance, position, and dimensions of the message div */  
  20. #message   
  21. {   
  22.     positionabsolute;   
  23.     top160px;   
  24.     width: 100%;   
  25.     height300px;   
  26.     background:transparent url('images/textBackground.png'repeat-x center;   
  27.     color#5C090A;   
  28.     font-size: 220%;   
  29.     font-family'Georgia';   
  30.     text-aligncenter;   
  31.     padding20px 10px;   
  32.     -webkit-box-sizing: border-box;   
  33.     -webkit-background-size: 100% 100%;   
  34.     z-index: 1;   
  35. }   
  36.   
  37. p {   
  38.   margin15px;   
  39. }   
  40.   
  41. a   
  42. {   
  43.   color#5C090A;   
  44.   text-decorationnone;   
  45. }   
  46.   
  47. /* Sets the color of the "Dino's Gardening Service" message */  
  48. em    
  49. {   
  50.     font-weightbold;   
  51.     font-stylenormal;   
  52. }   
  53.   
  54. .phone {   
  55.   font-size: 150%;   
  56.   vertical-alignmiddle;   
  57. }   
  58.   
  59. /* This CSS rule is applied to all div elements in the leafContainer div.  
  60.    It styles and animates each leafDiv.  
  61. */  
  62. #leafContainer > div    
  63. {   
  64.     positionabsolute;   
  65.     width100px;   
  66.     height100px;   
  67.   
  68.     /* We use the following properties to apply the fade and drop animations to each leaf.  
  69.        Each of these properties takes two values. These values respectively match a setting  
  70.        for fade and drop.  
  71.     */  
  72.     -webkit-animation-iteration-count: infinite, infinite;   
  73.     -webkit-animation-directionnormalnormal;   
  74.     -webkit-animation-timing-function: linear, ease-in;   
  75. }   
  76.   
  77. /* This CSS rule is applied to all img elements directly inside div elements which are  
  78.    directly inside the leafContainer div. In other words, it matches the 'img' elements  
  79.    inside the leafDivs which are created in the createALeaf() function.  
  80. */  
  81. #leafContainer > div > img {   
  82.      positionabsolute;   
  83.      width100px;   
  84.      height100px;   
  85.   
  86.     /* We use the following properties to adjust the clockwiseSpin or counterclockwiseSpinAndFlip  
  87.        animations on each leaf.  
  88.        The createALeaf function in the Leaves.js file determines whether a leaf has the   
  89.        clockwiseSpin or counterclockwiseSpinAndFlip animation.  
  90.     */  
  91.      -webkit-animation-iteration-count: infinite;   
  92.      -webkit-animation-direction: alternate;   
  93.      -webkit-animation-timing-function: ease-in-out;   
  94.      -webkit-transform-origin: 50% -100%;   
  95. }   
  96.   
  97. /* Hides a leaf towards the very end of the animation */  
  98. @-webkit-keyframes fade   
  99. {   
  100.     /* Show a leaf while into or below 95 percent of the animation and hide it, otherwise */  
  101.     0%   { opacity: 1; }   
  102.     95%  { opacity: 1; }   
  103.     100% { opacity: 0; }   
  104. }   
  105.   
  106. /* Makes a leaf fall from -300 to 600 pixels in the y-axis */  
  107. @-webkit-keyframes drop   
  108. {   
  109.     /* Move a leaf to -300 pixels in the y-axis at the start of the animation */  
  110.     0%   { -webkit-transform: translate(0px, -50px); }   
  111.     /* Move a leaf to 600 pixels in the y-axis at the end of the animation */  
  112.     100% { -webkit-transform: translate(0px650px); }   
  113. }   
  114.   
  115. /* Rotates a leaf from -50 to 50 degrees in 2D space */  
  116. @-webkit-keyframes clockwiseSpin   
  117. {   
  118.     /* Rotate a leaf by -50 degrees in 2D space at the start of the animation */  
  119.     0%   { -webkit-transform: rotate(-50deg); }   
  120.     /*  Rotate a leaf by 50 degrees in 2D space at the end of the animation */  
  121.     100% { -webkit-transform: rotate(50deg); }   
  122. }   
  123.   
  124. /* Flips a leaf and rotates it from 50 to -50 degrees in 2D space */  
  125. @-webkit-keyframes counterclockwiseSpinAndFlip    
  126. {   
  127.     /* Flip a leaf and rotate it by 50 degrees in 2D space at the start of the animation */  
  128.     0%   { -webkit-transform: scale(-1, 1) rotate(50deg); }   
  129.     /* Flip a leaf and rotate it by -50 degrees in 2D space at the end of the animation */  
  130.     100% { -webkit-transform: scale(-1, 1) rotate(-50deg); }   
  131. }   

JavaScript代碼

JavaScript Code復制內容到剪貼板
  1. /* Define the number of leaves to be used in the animation */  
  2. const NUMBER_OF_LEAVES = 30;   
  3.   
  4. /*   
  5.     Called when the "Falling Leaves" page is completely loaded.  
  6. */  
  7. function init()   
  8. {   
  9.     /* Get a reference to the element that will contain the leaves */  
  10.     var container = document.getElementById('leafContainer');   
  11.     /* Fill the empty container with new leaves */  
  12.     for (var i = 0; i < NUMBER_OF_LEAVES; i++)    
  13.     {   
  14.         container.appendChild(createALeaf());   
  15.     }   
  16. }   
  17.   
  18. /*  
  19.     Receives the lowest and highest values of a range and  
  20.     returns a random integer that falls within that range.  
  21. */  
  22. function randomInteger(low, high)   
  23. {   
  24.     return low + Math.floor(Math.random() * (high - low));   
  25. }   
  26.   
  27. /*  
  28.    Receives the lowest and highest values of a range and  
  29.    returns a random float that falls within that range.  
  30. */  
  31. function randomFloat(low, high)   
  32. {   
  33.     return low + Math.random() * (high - low);   
  34. }   
  35.   
  36. /*  
  37.     Receives a number and returns its CSS pixel value.  
  38. */  
  39. function pixelValue(value)   
  40. {   
  41.     return value + 'px';   
  42. }   
  43.   
  44. /*  
  45.     Returns a duration value for the falling animation.  
  46. */  
  47.   
  48. function durationValue(value)   
  49. {   
  50.     return value + 's';   
  51. }   
  52.   
  53. /*  
  54.     Uses an img element to create each leaf. "Leaves.css" implements two spin   
  55.     animations for the leaves: clockwiseSpin and counterclockwiseSpinAndFlip. This  
  56.     function determines which of these spin animations should be applied to each leaf.  
  57.  
  58. */  
  59. function createALeaf()   
  60. {   
  61.     /* Start by creating a wrapper div, and an empty img element */  
  62.     var leafDiv = document.createElement('div');   
  63.     var image = document.createElement('img');   
  64.   
  65.     /* Randomly choose a leaf image and assign it to the newly created element */  
  66.     image.src = 'images/realLeaf' + randomInteger(1, 5) + '.png';   
  67.   
  68.     leafDiv.style.top = "-100px";   
  69.   
  70.     /* Position the leaf at a random location along the screen */  
  71.     leafDiv.style.left = pixelValue(randomInteger(0, 500));   
  72.   
  73.     /* Randomly choose a spin animation */  
  74.     var spinAnimationName = (Math.random() < 0.5) ? 'clockwiseSpin' : 'counterclockwiseSpinAndFlip';   
  75.   
  76.     /* Set the -webkit-animation-name property with these values */  
  77.     leafDiv.style.webkitAnimationName = 'fade, drop';   
  78.     image.style.webkitAnimationName = spinAnimationName;   
  79.   
  80.     /* Figure out a random duration for the fade and drop animations */  
  81.     var fadeAndDropDuration = durationValue(randomFloat(5, 11));   
  82.   
  83.     /* Figure out another random duration for the spin animation */  
  84.     var spinDuration = durationValue(randomFloat(4, 8));   
  85.     /* Set the -webkit-animation-duration property with these values */  
  86.     leafDiv.style.webkitAnimationDuration = fadeAndDropDuration + ', ' + fadeAndDropDuration;   
  87.   
  88.     var leafDelay = durationValue(randomFloat(0, 5));   
  89.     leafDiv.style.webkitAnimationDelay = leafDelay + ', ' + leafDelay;   
  90.   
  91.     image.style.webkitAnimationDuration = spinDuration;   
  92.   
  93.     // add the <img> to the <div>   
  94.     leafDiv.appendChild(image);   
  95.   
  96.     /* Return this img element so it can be added to the document */  
  97.     return leafDiv;   
  98. }   
  99.   
  100. /* Calls the init function when the "Falling Leaves" page is full loaded */  
  101. window.addEventListener('load', init, false);   

以上就是本文的全部內容,希望對大家學習有所幫助。

標簽:德州 蚌埠 內蒙古 辛集 黃山 楊凌 撫順 鶴崗

巨人網絡通訊聲明:本文標題《逼真的HTML5樹葉飄落動畫》,本文關鍵詞  逼,真的,HTML5,樹葉,飄落,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《逼真的HTML5樹葉飄落動畫》相關的同類信息!
  • 本頁收集關于逼真的HTML5樹葉飄落動畫的相關信息資訊供網民參考!
  • 推薦文章
    校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃
    午夜视频久久久久久| 久久成人综合网| 91精品国产一区二区三区蜜臀| 国产一区二区三区四区五区美女| 一卡二卡欧美日韩| 久久蜜桃一区二区| 欧美在线观看一区二区| 国产成人精品三级| 三级欧美在线一区| 一区二区在线免费观看| 久久久久高清精品| 4438x成人网最大色成网站| 成人一区二区三区视频| 麻豆91在线播放| 亚洲一区二区视频| 中文字幕在线视频一区| wwwwxxxxx欧美| 日韩一级免费一区| 欧美日韩精品一区二区三区四区 | 欧美丝袜丝交足nylons图片| 国产精品自产自拍| 美日韩一区二区| 午夜精品久久一牛影视| 亚洲欧美日韩成人高清在线一区| 日本一区二区三区电影| www精品美女久久久tv| 欧美一区二区视频观看视频| 欧美视频一区在线| 欧洲av在线精品| 91在线播放网址| 成av人片一区二区| 成人午夜电影网站| 国产高清成人在线| 国产一区二区三区四区五区入口| 麻豆精品视频在线观看视频| 日韩高清电影一区| 日韩精品成人一区二区三区| 亚洲尤物视频在线| 一区二区高清免费观看影视大全| 亚洲欧美另类久久久精品2019 | 亚洲成人自拍一区| 亚洲午夜激情av| 亚洲成人动漫av| 午夜精品久久久久久久99水蜜桃| 亚洲国产精品一区二区www在线| 亚洲激情五月婷婷| 亚洲一区在线视频观看| 亚洲高清免费视频| 日韩成人一级片| 久久99在线观看| 国产原创一区二区| 国产成a人无v码亚洲福利| 国产不卡视频在线观看| 暴力调教一区二区三区| 99国产精品国产精品毛片| 成人h动漫精品| 一本久久综合亚洲鲁鲁五月天| 色成年激情久久综合| 欧美日韩在线电影| 欧美一级久久久久久久大片| 日韩欧美国产综合| 中文字幕免费不卡| 一区二区三区欧美在线观看| 日韩影院精彩在线| 韩国av一区二区| 99视频在线观看一区三区| 欧美色精品在线视频| 欧美一区二区三区喷汁尤物| wwwwxxxxx欧美| 亚洲色图欧美在线| 午夜精品福利一区二区三区蜜桃| 男女性色大片免费观看一区二区 | 国产免费观看久久| 亚洲黄色小说网站| 麻豆成人在线观看| 91丝袜高跟美女视频| 欧美丰满少妇xxxxx高潮对白| 欧美tk—视频vk| 亚洲日本青草视频在线怡红院 | 成人免费视频一区二区| 99热在这里有精品免费| 欧美日韩亚洲综合在线 | 欧美三级中文字幕在线观看| 日韩女优av电影| 一区在线中文字幕| 日本成人在线电影网| 国产成人在线色| 欧美高清性hdvideosex| 国产调教视频一区| 午夜欧美视频在线观看| 成人精品国产免费网站| 欧美片网站yy| 国产精品久久精品日日| 奇米色一区二区三区四区| 成人高清av在线| 这里是久久伊人| 亚洲精品中文字幕在线观看| 精品亚洲成av人在线观看| 欧美性videosxxxxx| 国产午夜久久久久| 婷婷开心久久网| 9i在线看片成人免费| 日韩欧美资源站| 亚洲第四色夜色| 91亚洲国产成人精品一区二区三| 精品日韩99亚洲| 日韩中文欧美在线| 91免费视频观看| 久久精品视频一区二区三区| 日韩精品国产精品| 91福利社在线观看| 最新中文字幕一区二区三区| 国产伦精品一区二区三区视频青涩| 欧美日韩精品免费| 亚洲制服丝袜av| 一本色道久久综合亚洲aⅴ蜜桃| 国产日韩精品一区二区三区在线| 美女久久久精品| 51精品视频一区二区三区| 一区二区三区在线观看视频| 成人免费观看男女羞羞视频| 精品伦理精品一区| 日本91福利区| 51精品久久久久久久蜜臀| 无吗不卡中文字幕| 欧美日韩一区二区欧美激情 | 国产视频一区二区在线观看| 激情综合色综合久久| 日韩一区二区三免费高清| 丝袜美腿亚洲综合| 在线播放91灌醉迷j高跟美女 | 日韩毛片视频在线看| 丁香六月综合激情| 中文字幕av一区二区三区免费看| 九九**精品视频免费播放| 欧美电影免费提供在线观看| 日韩高清在线不卡| 日韩欧美资源站| 国产一区二区在线电影| 久久综合中文字幕| 成人免费视频免费观看| 日本一区二区久久| 不卡的电视剧免费网站有什么| 国产亚洲精品中文字幕| 国产不卡一区视频| 亚洲人成在线播放网站岛国| 色综合天天综合给合国产| 一区二区三区在线视频免费| 91电影在线观看| 日韩和欧美的一区| 欧美va天堂va视频va在线| 国产精品18久久久久久久网站| 国产日韩欧美高清| 日本高清无吗v一区| 亚洲成人av一区| 日韩亚洲欧美一区| 国产精品一卡二| 亚洲三级在线观看| 欧美精品乱码久久久久久按摩 | 18涩涩午夜精品.www| 色哟哟精品一区| 日本伊人精品一区二区三区观看方式| 91麻豆精品国产| 国产福利精品导航| 亚洲美女淫视频| 日韩免费视频一区| 成人久久久精品乱码一区二区三区| 亚洲少妇最新在线视频| 7777精品伊人久久久大香线蕉超级流畅 | 国产精品久久久久久久久搜平片 | 亚洲精品一区二区三区精华液| 国产精品羞羞答答xxdd| 亚洲日本va午夜在线影院| 欧美另类一区二区三区| 国内精品久久久久影院色| 亚洲丝袜制服诱惑| 欧美一区二区三区视频| 国产成人综合亚洲网站| 亚洲黄色在线视频| 久久亚洲精品国产精品紫薇| 91麻豆免费观看| 久久精工是国产品牌吗| 亚洲天堂精品视频| 2019国产精品| 欧美性色欧美a在线播放| 国内精品久久久久影院色 | 视频一区二区欧美| 中文字幕永久在线不卡| 欧美一级片在线观看| 99久久精品一区二区| 老司机精品视频在线| 一区二区三区精品在线观看| 久久久久高清精品| 欧美一区二区视频在线观看2020 | 激情成人午夜视频| 亚洲国产精品视频| 中文字幕第一区综合| 欧美一级日韩免费不卡| 在线免费视频一区二区| 国产电影一区在线|