Judul : Pure Css Snow fall animation with Cat moving Animation
link : Pure Css Snow fall animation with Cat moving Animation
Pure Css Snow fall animation with Cat moving Animation
Pure Css Snow fall animation with Cat moving Animation
Merry Christmas!!!
I've never felt the snowfall. But I've seen many movies about Christmas and snow fall. Merry Christmas to all of you. Today I�m going to show some animation of snow fall with cat moving with pure css without any JavaScript. I get help from different blogs to create this demo. The demo is simply of css and use Images to animate and create the animation effect.
Html Body:
The body consists of simple html div with class name. Div falling for snow falling and div tuna for moving cat.
The CSS:
Now to create the effect, we need different images. We need three different snow images of different sizes and focus. Next we need the sprite image of cat to make the cat move. We�ll overlay the images on the top of another to make the effect of moving.
Next thing is to make animation. Here we use keyframe. This is required to make animation of the images.
Final Code
Image source:
Background image: jazzalert[dot]files[dot]wordpress[dot]com/2009/12/cd-snow-night-square.jpg
Moving cat: stash[dot]rachelnabors[dot]com/img/codepen/tuna_sprite.png
Merry Christmas!!!
I've never felt the snowfall. But I've seen many movies about Christmas and snow fall. Merry Christmas to all of you. Today I�m going to show some animation of snow fall with cat moving with pure css without any JavaScript. I get help from different blogs to create this demo. The demo is simply of css and use Images to animate and create the animation effect.
DEMO
Getting StartedHtml Body:
The body consists of simple html div with class name. Div falling for snow falling and div tuna for moving cat.
<div id='falling-snow' style=" left: 0; top: 0;"> </div>
<div class="tuna"></div>
The CSS:
Now to create the effect, we need different images. We need three different snow images of different sizes and focus. Next we need the sprite image of cat to make the cat move. We�ll overlay the images on the top of another to make the effect of moving.
html {text-align: center;}
body{
background: url(cd-snow-night-square.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.tuna {
background: url(http://stash.rachelnabors.com/img/codepen/tuna_sprite.png) 0 0 no-repeat;
background-size: 800px auto;
height: 100px;
width: 200px;
top:90%;
}
#falling-snow {
background-image: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT2VHZo_EvFmH3VZ92yWLlTeX4hXie5qYCWCR2CBRtNRoEWqoAflcXcqKkNjC4TDOOKYGrObbCP-TS3J0E5dVxAsda_sRYsUHXlNkwXlA2pJmosJbfbHqZjdKFlpXOcxuirkxhIEAotNVO/s1600/snow.png), url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR7nMXfBr_pqhNmXlLDjNrCbN-cMxLs2rlw9-3q2icS4JuJuk0TeQHie8gLgWsa0inLL2KKjAX3ItyiMTFnz5elIX4yXH6AdZ9DCDJxAJtRIUrDDQs_BoBbhQF23mjdkwzNF3Y4T-8NusG/s1600/snow3.png), url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5x4mRuiF765i0iDnQlltbwR9M4f1GfO6Ou0roNtUWtNN0Us_MrCt4CN_X5zKiGKPLzJ7Jx1Y5gSwdsopiHVqsAHgWvYR_Nmw2VXR2QVkD9C2B-iTk5ZGDEWL7R_duz5BIGMu0Wq-boSaM/s1600/snow2.png);
width:100%;
height:100%;
}
Next thing is to make animation. Here we use keyframe. This is required to make animation of the images.
@keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
@-moz-keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
@-webkit-keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
@-ms-keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
@keyframes walk-cycle {
0% {background-position: 0 0; }
100% {background-position: 0 -1191.5px; }
}
Here keyframe name snow is for falling snow and walk-cycle is for walking cat.
Now we add keyframe to respective image div to show the animation
#falling-snow {
background-image: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT2VHZo_EvFmH3VZ92yWLlTeX4hXie5qYCWCR2CBRtNRoEWqoAflcXcqKkNjC4TDOOKYGrObbCP-TS3J0E5dVxAsda_sRYsUHXlNkwXlA2pJmosJbfbHqZjdKFlpXOcxuirkxhIEAotNVO/s1600/snow.png), url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR7nMXfBr_pqhNmXlLDjNrCbN-cMxLs2rlw9-3q2icS4JuJuk0TeQHie8gLgWsa0inLL2KKjAX3ItyiMTFnz5elIX4yXH6AdZ9DCDJxAJtRIUrDDQs_BoBbhQF23mjdkwzNF3Y4T-8NusG/s1600/snow3.png), url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5x4mRuiF765i0iDnQlltbwR9M4f1GfO6Ou0roNtUWtNN0Us_MrCt4CN_X5zKiGKPLzJ7Jx1Y5gSwdsopiHVqsAHgWvYR_Nmw2VXR2QVkD9C2B-iTk5ZGDEWL7R_duz5BIGMu0Wq-boSaM/s1600/snow2.png);
-webkit-animation: snow 20s linear infinite;
-moz-animation: snow 20s linear infinite;
-ms-animation: snow 20s linear infinite;
animation: snow 20s linear infinite;
width:100%;
height:100%;
}
.tuna {
animation: walk-cycle 1s steps(6) infinite;
background: url(http://stash.rachelnabors.com/img/codepen/tuna_sprite.png) 0 0 no-repeat;
background-size: 800px auto;
height: 100px;
width: 200px;
top:90%;
}
Now the last thing left is to move the cat. For this we use code marquee to move the cat from one end to another.
<marquee>
<div class="tuna"></div>
</marquee>
Final Code
<!doctype html>
<html>
<head>
<title>Falling Snow with Cat Moving Example | educateinsure.blogspot.com</title>
<style>
@keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
@-moz-keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
@-webkit-keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
@-ms-keyframes snow {
0% {background-position: 0px 0px, 0px 0px, 0px 0px;}
100% {background-position: 500px 1000px, 400px 400px, 300px 300px;}
}
body{position:relative;background-color:red;}
#falling-snow {
background-image: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIzZ9TzBlJxe8QHa7blJ5oCR0mhxTnHHM0SgiabCrVTtN2fdPYwyox297uAfbxbTDjugo6bE_UkPGIcHJPb-Erfg89O8BTeACTi8QBBFU32I3Lv8UN4bWM5KwV5LcsYH5wnHLAPQMtqi6E/s1600/snow.png), url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAEYmK-YWphS71mwdFG2HeRTOKol-gIFwY-aIREujsfvLCbf50xit3Wi-zndxWBv9bFoMNCDoPl8Z3YA8-7MrKUczmoZoGZ6fwY5lp_GKlx-llWgrApdu1sDabrpQPa7RSVZCHbNJu8uLv/s320/snow3.png), url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjFaK1oJ_Ca60Vyc7mucHWM5iHfHKPAcbUeIiVdTjKaxXvfkCrQy44SM3eWpfW50KbjpXcEvkziwrp2LvoVuNeSMN43WdPVQWAFGZD99u-MiR2HYjvPvvSr7CcLQmRJ8McWfw72zOp2F8r/s1600/snow2.png);
-webkit-animation: snow 20s linear infinite;
-moz-animation: snow 20s linear infinite;
-ms-animation: snow 20s linear infinite;
animation: snow 20s linear infinite;
width:100%;
height:100%;
}
.tuna {
animation: walk-cycle 1s steps(6) infinite;
background: url(http://stash.rachelnabors.com/img/codepen/tuna_sprite.png) 0 0 no-repeat;
background-size: 800px auto;
height: 100px;
width: 200px;
top:90%;
}
@keyframes walk-cycle {
0% {background-position: 0 0; }
100% {background-position: 0 -1191.5px; }
}
body{
background: url(cd-snow-night-square.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
html {text-align: center;}
</style>
<body>
<div id='falling-snow' style=" left: 0; top: 0;">
</div>
<marquee>
<div class="tuna"></div>
</marquee>
</body>
Conclusion
So, we have here the complete example of pure css animation of snow fall and moving cat. The DemoCan is seen Here You will need CSS3 support browser to view the demo. Prefer Mozilla firefox.
Image source:
Background image: jazzalert[dot]files[dot]wordpress[dot]com/2009/12/cd-snow-night-square.jpg
Moving cat: stash[dot]rachelnabors[dot]com/img/codepen/tuna_sprite.png
Demikianlah Artikel Pure Css Snow fall animation with Cat moving Animation
Sekianlah artikel Pure Css Snow fall animation with Cat moving Animation kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel Pure Css Snow fall animation with Cat moving Animation dengan alamat link https://site-car-insurance.blogspot.com/2016/07/pure-css-snow-fall-animation-with-cat.html