css - CSS3 Animations Questions -
trying have 3 elements show 1 after other on page following happens.
all 3 elements appear, first element doesn't (it appears have gone through it's animation) second element disappears , starts it's animation , same thing third element.
here's code, missing here:
@-webkit-keyframes reset { 0% {opacity: 0;} 100% {opacity: 0;} } @-webkit-keyframes fade-in { 0% { opacity: 0; -webkit-transform: scale(.1);} 85% {opacity: 1; -webkit-transform: scale(1.05);} 100% {-webkit-transform: scale(1);} } .fade-in { -webkit-animation-name: reset, fade-in; -webkit-animation-duration: .5s; -webkit-animation-timing-function: ease-in; -webkit-animation-iteration-count: 1; } .fade-in.one {-webkit-animation-delay: 0, .5;} .fade-in.two {-webkit-animation-delay: 0, 1.5s;} .fade-in.three {-webkit-animation-delay: 0, 2.5s;} thanks in advance
the main problem code missing time unit...
.fade-in.one {-webkit-animation-delay: 0, .5s;} while testing code took liberty simplify bit. there no need have 2 separate animations, there little known property called -webkit-animation-fill-mode allow animation remain in last state. here refactored version:
@-webkit-keyframes fade-in { 0% { opacity: 0; -webkit-transform: scale(.1);} 85% {opacity: 1; -webkit-transform: scale(1.05);} 100% {-webkit-transform: scale(1); opacity: 1;} } .fade-in { -webkit-animation: fade-in .5s ease-in; -webkit-animation-fill-mode: forwards; -webkit-animation-iteration-count: 1; opacity: 0; } .fade-in.one {-webkit-animation-delay: .5s;} .fade-in.two {-webkit-animation-delay: 1.5s;} .fade-in.three {-webkit-animation-delay: 2.5s;} you can check out here:
Comments
Post a Comment