css - How do I slow down a keyframe animation? -
i have code:
.blur { -webkit-animation: blur 5s ; -webkit-animation-fill-mode: forwards; } @-webkit-keyframes blur { 0% { -webkit-filter: blur(0px); } 0% { -webkit-filter: blur(1px); } 50% { -webkit-filter: blur(5px); } 60% { -webkit-filter: blur(5px); } 100% { opacity: 0; } } <img src="http://placehold.it/350x150" class="blur" /> basically have image , effect want fade in slowly, blur , fade out. when blurs want stay there few seconds , fade out picture. please me out? thanks
thinking in terms of keyframes, want let animation know when start fading. otherwise assumes you're working towards final opacity duration of animation.
to prevent this, pin opacity @ 1 prior beginning fade. try this:
.blur { -webkit-animation: blur 5s ; -webkit-animation-fill-mode: forwards; } @-webkit-keyframes blur { 0% { -webkit-filter: blur(0px); } 0% { -webkit-filter: blur(1px); } 50% { -webkit-filter: blur(5px); } 60% { -webkit-filter: blur(5px); } 90% { -webkit-filter: blur(5px); opacity: 1; } 100% { opacity: 0; } } <img src="http://placehold.it/350x150" class="blur" /> the above code starts fadeout in last 10% of animation - otherwise, blurred image hangs around. can nudge duration both .blur duration , keyframe percentages (larger percentage spread = longer time before fading out).
Comments
Post a Comment