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

主頁 > 知識庫 > 逼真的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樹葉飄落動畫的相關信息資訊供網民參考!
  • 推薦文章
    校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃
    日韩电影一区二区三区四区| 国产传媒久久文化传媒| 国产成人欧美日韩在线电影| 精品视频全国免费看| 国产精品国产三级国产aⅴ无密码| 日韩精品一区第一页| 色香色香欲天天天影视综合网| 欧美电视剧在线看免费| 亚洲成人动漫在线免费观看| 波多野结衣91| 亚洲国产成人一区二区三区| 久久av老司机精品网站导航| 56国语精品自产拍在线观看| 一区二区国产盗摄色噜噜| 99精品热视频| 国产精品高潮呻吟久久| 国产乱子伦视频一区二区三区| 欧美一区二区三区日韩| 亚洲午夜久久久久久久久久久| 91亚洲精品一区二区乱码| 国产精品私人影院| 成人国产亚洲欧美成人综合网 | 国产精品伊人色| 91精品国产色综合久久| 五月激情综合色| 欧美伦理电影网| 日本一道高清亚洲日美韩| 欧美日韩国产一区| 午夜精品久久久久久久久久久| 在线观看欧美黄色| 亚洲成人激情自拍| 91精品福利在线一区二区三区| 亚洲第一狼人社区| 日韩一区二区在线观看视频 | 国产成人精品免费在线| 久久久久久久久蜜桃| 成人一区二区视频| 亚洲精品成人在线| 欧美色中文字幕| 蜜桃传媒麻豆第一区在线观看| 日韩亚洲电影在线| 国产91精品一区二区麻豆网站| 亚洲国产成人精品视频| 欧美精品亚洲二区| 激情综合网天天干| 中文幕一区二区三区久久蜜桃| 91在线观看成人| 亚洲综合丝袜美腿| 日韩一区二区在线免费观看| 国产剧情一区二区| 亚洲久本草在线中文字幕| 欧美日韩一区视频| 国产在线看一区| 亚洲美女视频在线观看| 91精品国产欧美日韩| 国产精品一区二区在线观看不卡| **性色生活片久久毛片| 欧美精品第一页| 国产成a人亚洲精| 亚洲成人精品一区| 久久精品夜色噜噜亚洲aⅴ| 91小视频在线| 久久99久久精品欧美| 亚洲少妇30p| 欧美成人伊人久久综合网| 99久久精品一区二区| 蜜臀a∨国产成人精品| 中文字幕视频一区| 日韩精品一区在线| 在线观看av一区二区| 国产精品夜夜嗨| 亚洲午夜一区二区| 久久精品欧美一区二区三区不卡| 一本色道**综合亚洲精品蜜桃冫| 美女视频网站黄色亚洲| 一区二区三区在线影院| 久久蜜桃av一区二区天堂| 欧美日韩在线播放三区四区| 成人免费高清在线| 久久精品免费观看| 亚洲午夜电影网| 最新国产の精品合集bt伙计| 精品人在线二区三区| 欧美日韩在线电影| 色综合网色综合| 成人的网站免费观看| 激情久久久久久久久久久久久久久久| 曰韩精品一区二区| 国产精品福利一区二区| 久久麻豆一区二区| 精品蜜桃在线看| 欧美一区二区三区的| 欧美亚男人的天堂| 日本韩国精品一区二区在线观看| 成人免费视频视频在线观看免费| 韩国中文字幕2020精品| 老司机免费视频一区二区三区| 亚洲成人手机在线| 亚洲一区二区三区爽爽爽爽爽| 中文字幕视频一区| 国产精品电影一区二区三区| 欧美—级在线免费片| 久久久久久久久免费| 精品久久国产字幕高潮| 欧美一区二区国产| 欧美一区二区三区公司| 欧美精品久久久久久久多人混战 | 亚洲精品视频一区| 日韩理论在线观看| 亚洲女人****多毛耸耸8| 1024精品合集| 日本aⅴ免费视频一区二区三区| 亚洲线精品一区二区三区| 亚洲午夜久久久久中文字幕久| 一区二区三区中文字幕精品精品| 亚洲精品你懂的| 亚洲国产精品天堂| 日韩综合小视频| 精品一区二区三区免费播放| 久久国产精品72免费观看| 久草在线在线精品观看| 国产乱码精品一区二区三区忘忧草| 国产麻豆精品theporn| 高潮精品一区videoshd| 波多野结衣中文字幕一区二区三区| 99国产精品久久久久久久久久| 一本大道综合伊人精品热热 | 91麻豆国产在线观看| 91黄视频在线观看| 777奇米成人网| 久久综合九色欧美综合狠狠| 中文欧美字幕免费| 亚洲伊人伊色伊影伊综合网| 日韩有码一区二区三区| 国产麻豆精品theporn| 97久久精品人人做人人爽50路| 在线精品国精品国产尤物884a| 欧美日韩成人激情| 久久久亚洲综合| 中文字幕一区二区三区在线观看 | 欧美国产日韩a欧美在线观看| 欧美国产欧美综合| 亚洲一区影音先锋| 国内成人免费视频| 色哟哟一区二区在线观看 | 国产精品三级在线观看| 一区二区三区在线观看动漫 | 一级日本不卡的影视| 美女视频黄 久久| aaa亚洲精品| 欧美大白屁股肥臀xxxxxx| 国产精品丝袜91| 日韩av在线播放中文字幕| 国产成人在线视频网址| 欧美唯美清纯偷拍| 国产婷婷色一区二区三区四区| 亚洲成人一区二区| 国产东北露脸精品视频| 欧美在线看片a免费观看| 久久久久久久av麻豆果冻| 亚洲国产裸拍裸体视频在线观看乱了 | 在线影院国内精品| 久久―日本道色综合久久| 亚洲综合色在线| 国产99久久久久| 日韩午夜激情电影| 亚洲国产cao| 色综合久久精品| 欧美精彩视频一区二区三区| 日本视频在线一区| 欧美怡红院视频| 中文字幕一区三区| 国产suv一区二区三区88区| 51精品久久久久久久蜜臀| 亚洲精品成人少妇| 97aⅴ精品视频一二三区| 精品1区2区在线观看| 中文字幕成人在线观看| 久久99国产精品久久| 欧美丰满高潮xxxx喷水动漫| 亚洲一区在线观看免费观看电影高清| 国产白丝精品91爽爽久久| 日韩午夜激情免费电影| 视频在线观看91| 欧美在线观看一区| 日韩美女啊v在线免费观看| 欧美性一级生活| 亚洲视频中文字幕| 99久久精品国产毛片| 中文久久乱码一区二区| 国产.欧美.日韩| 精品久久国产老人久久综合| 久久国产精品第一页| 精品国产不卡一区二区三区| 麻豆国产精品视频| 欧美videossexotv100| 久久精品国产亚洲aⅴ| 日韩欧美一区二区视频| 久久99热这里只有精品| 久久亚洲一级片|