亚洲综合原千岁中文字幕_国产精品99久久久久久久vr_无码人妻aⅴ一区二区三区浪潮_成人h动漫精品一区二区三

主頁 > 知識庫 > 逼真的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樹葉飄落動畫的相關信息資訊供網民參考!
  • 推薦文章
    国产不卡高清在线观看视频 | 欧美激情影院| 久久久久久久久综合影视网| 麻豆系列 在线视频| 欧美激情影院| 一本高清在线| 成人高清视频在线观看| 日本特黄特色aaa大片免费| 久久久久久久久综合影视网| 韩国毛片免费| 色综合久久天天综线观看| 精品视频在线看| 超级乱淫伦动漫| 久久精品大片| 精品视频在线观看免费| 精品在线免费播放| 午夜激情视频在线播放| 国产一区二区精品尤物| 国产91丝袜在线播放0| 天堂网中文字幕| 四虎影视久久| 日韩在线观看网站| 国产成人女人在线视频观看| 日韩一级黄色片| 精品久久久久久中文字幕2017| 日本特黄特色aaa大片免费| 国产91丝袜在线播放0| 成人av在线播放| 国产原创视频在线| 黄视频网站在线看| 韩国三级香港三级日本三级| 亚欧成人乱码一区二区| 国产一区二区精品久久91| 久久精品大片| 国产一区二区精品久久91| 精品在线免费播放| 毛片成人永久免费视频| 精品久久久久久中文字幕2017| 黄色免费三级| 精品在线免费播放| 天天色成人网| a级毛片免费观看网站| 高清一级淫片a级中文字幕| 台湾毛片| 日韩专区亚洲综合久久| 黄视频网站在线看| 国产一区二区福利久久| 欧美激情伊人| 精品在线免费播放| 免费国产在线观看| 国产韩国精品一区二区三区| 国产一级生活片| 午夜精品国产自在现线拍| 天天色成人网| 91麻豆精品国产自产在线观看一区| 欧美国产日韩精品| 天天做日日爱| 国产a视频精品免费观看| 国产精品免费久久| 日韩免费在线| 国产一区二区福利久久| 天堂网中文字幕| 韩国三级香港三级日本三级| 高清一级淫片a级中文字幕| 亚洲女人国产香蕉久久精品| 超级乱淫伦动漫| 国产伦理精品| 二级片在线观看| 久久久久久久久综合影视网| 欧美激情影院| 91麻豆爱豆果冻天美星空| 高清一级淫片a级中文字幕| 国产精品免费久久| 国产高清在线精品一区a| 黄色福利| 国产成人精品综合久久久| 天天做日日爱| 你懂的日韩| 高清一级淫片a级中文字幕| 九九久久国产精品大片| 欧美激情一区二区三区视频 | 国产高清在线精品一区a| 毛片成人永久免费视频| 国产福利免费视频| 日本特黄特色aaa大片免费| 韩国三级视频网站| 国产网站免费视频| 九九久久国产精品大片| 91麻豆精品国产高清在线| 日韩中文字幕在线播放| 亚洲wwwwww| 青青青草视频在线观看| 精品久久久久久中文字幕2017| 麻豆系列 在线视频| 精品久久久久久中文字幕2017| 亚洲wwwwww| 国产一区二区精品久久91| 国产原创视频在线| 国产极品白嫩美女在线观看看| 日韩男人天堂| 色综合久久天天综线观看| 天天色成人网| 国产成人精品综合久久久| 久久精品大片| 欧美激情伊人| 九九久久国产精品大片| 精品视频一区二区| 久久国产精品永久免费网站| 黄色免费三级| 欧美激情伊人| 精品视频在线观看免费| 国产91丝袜在线播放0| 黄视频网站免费| 成人免费高清视频| 国产91精品系列在线观看| 久久国产影视免费精品| 亚洲精品久久久中文字| 九九久久国产精品大片| 欧美激情一区二区三区在线| 台湾毛片| 日本久久久久久久 97久久精品一区二区三区 狠狠色噜噜狠狠狠狠97 日日干综合 五月天婷婷在线观看高清 九色福利视频 | 欧美另类videosbestsex高清| 日本久久久久久久 97久久精品一区二区三区 狠狠色噜噜狠狠狠狠97 日日干综合 五月天婷婷在线观看高清 九色福利视频 | 99久久视频| 欧美大片一区| 韩国毛片免费| 国产麻豆精品高清在线播放| 青青青草视频在线观看| 日韩在线观看免费| 欧美激情伊人| 色综合久久天天综合| 999精品在线| 国产不卡高清在线观看视频 | 日日日夜夜操| 你懂的日韩| a级毛片免费观看网站| 韩国三级视频网站| 国产不卡在线观看视频| 国产一区精品| 国产精品免费久久| 日韩一级黄色片| 青青久热| 美女免费毛片| 毛片成人永久免费视频| 国产韩国精品一区二区三区| 国产一区二区精品久久91| 国产麻豆精品高清在线播放| 天天做日日爱| 日韩在线观看网站| 日韩专区亚洲综合久久| 国产不卡高清在线观看视频 | 九九久久国产精品大片| 99色视频在线观看| 国产综合91天堂亚洲国产| 午夜在线亚洲| 超级乱淫伦动漫| 99久久视频| 成人免费网站久久久| 国产高清在线精品一区a| 二级片在线观看| 久久国产影视免费精品| 国产福利免费视频| 亚欧成人乱码一区二区| 九九精品在线| 午夜在线亚洲| 99色视频在线观看| 亚洲天堂在线播放| 国产91精品系列在线观看| 欧美激情影院| 精品视频在线观看免费| 一级女性全黄久久生活片| 国产韩国精品一区二区三区| 精品久久久久久中文字幕2017| 国产一区二区精品久久91| 久草免费在线观看| 亚洲精品永久一区| 一本高清在线| 欧美激情一区二区三区视频 | 精品久久久久久中文字幕2017| 国产综合91天堂亚洲国产| 可以免费看毛片的网站| 四虎影视久久| 久久99这里只有精品国产| 台湾毛片| 麻豆系列 在线视频| 日本特黄特色aaa大片免费| 国产一级生活片| 毛片成人永久免费视频| 香蕉视频亚洲一级| 亚洲wwwwww| 日韩av片免费播放| 欧美18性精品| 国产一区二区福利久久| 久久国产精品永久免费网站| 高清一级淫片a级中文字幕| 九九九网站| 91麻豆精品国产高清在线| 国产一区二区精品尤物| 亚洲女人国产香蕉久久精品| 欧美激情影院|