Brief Tutorials
This is a very cool effect of pure CSS3 lifelike multi-layer cloud animation effects. This effect uses multiple transparent cloud PNG images as background images, and uses CSS animation animations to animate the horizontal fluttering of clouds.
View Source Download Plugin
How to use
HTML structure
The HTML structure of the multi-layer cloud animation effect is very simple: use a P.sky as the background layer of the feed, and place many sub-<p> as cloud containers inside it.
<p class= "Sky" > <p class= "Clouds_one" ></p> <p class= "Clouds_two" ></p> <p class= "Clouds_three" ></p></p>
CSS Styles
As the sky background. The sky element sets a fixed height, uses relative positioning, and uses Overflow:hidden to hide out-of-bounds elements. At the beginning, the color of the sky is set to a lighter blue #007fd5. A sky_background CSS3 animation animation is then set for the sky background, which transitions the sky background color from light blue to dark blue for 50 seconds, The animation's animation-timing-function is Ease-out, and the number of iterations of the animation animation-iteration-count to an infinite loop.
In this effect, each element is set with the Transform:translate3d (0, 0, 0) attribute, which is used to turn on the 3D effect of the GPU and improve the performance of the display.
. Sky { height:480px; Background: #007fd5; position:relative; Overflow:hidden; -webkit-animation:sky_background 50s ease-out Infinite; -moz-animation:sky_background 50s ease-out Infinite; -o-animation:sky_background 50s ease-out Infinite; Animation:sky_background 50s ease-out Infinite; -webkit-transform:translate3d (0, 0, 0); -ms-transform:translate3d (0, 0, 0); -o-transform:translate3d (0, 0, 0); Transform:translate3d (0, 0, 0); } @keyframes Sky_background { 0% { background: #007fd5; Color: #007fd5 } 50% { background: #000; Color: #a3d9ff } 100% { background: #007fd5; Color: #007fd5 } }
Cloud 1 uses the first cloud PNG image as the background image, using absolute positioning, relative to the sky container to align left. The height is equal to the sky and is 3 times times the width of the sky container. and perform cloud_one CSS3 animations. The animation modifies the left property of the cloud layer to make the cloud move horizontally.
. clouds_one { background:url ("Img/cloud_one.png"); Position:absolute; left:0; top:0; height:100%; width:300%; -webkit-animation:cloud_one 50s linear infinite; -moz-animation:cloud_one 50s linear infinite; -o-animation:cloud_one 50s linear infinite; Animation:cloud_one 50s linear infinite; -webkit-transform:translate3d (0, 0, 0); -ms-transform:translate3d (0, 0, 0); -o-transform:translate3d (0, 0, 0); Transform:translate3d (0, 0, 0); } @keyframes Cloud_one { 0% { left:0 } 100% {left : -200% } }
The CSS3 animations of Cloud 2 and cloud 3 are basically similar to Cloud 1, except that the duration of the animation is Animation-duration different, the duration of the Cloud 1 is 50 seconds, the duration of the Cloud 2 is 75 seconds, and the duration of the Cloud 3 is 100 seconds. In this way, the animation time of each cloud is different, and the effect of some background visual difference will be obtained.