animation - Multiple CSS transitions -
i having problem getting 2 transitions work together.
the second animation works (partially) swing effect seems reset , stop repeating after while , first animation doesn't work @ all.
this animation code:
.box{ width:250px; height:50px; background:blue; border: 1px solid black; position:fixed; left: 50%; margin-left:-125px; top:0px; animation-name: fall; animation-duration: 1.5s; animation-timing-function: ease-in; animation-name: swing; animation-duration: 4s; animation-iteration-count:infinte; animation-timing-function: ease-in-out; animation-delay: 1.4s; } @-moz-keyframes fall{ {top: -50px;} {top: 0px;} } @-webkit-keyframes fall{ {top: -50px;} {top: 0px;} } @-moz-keyframes swing{ -moz-transform-origin: center top; 0%{-moz-transform:rotate(-3deg)} 50%{-moz-transform:rotate(-2deg)} 100%{-moz-transform:rotate(-3deg)} } @-webkit-keyframes swing{ -webkit-transform-origin:center top; 0%{-webkit-transform:rotate(-3deg)} 50%{-webkit-transform:rotate(-2deg)} 100%{-webkit-transform:rotate(-3deg)} }
demo can found here problem shown: http://jsfiddle.net/akwbmw86/
what getting wrong here?
you're mixing browser specific prefixes no browser specific prefixes, specify multiple animations need separate them commma. in example fall animation overwritten swing animation.
something this:
.box{ width:250px; height:50px; background:blue; border: 1px solid black; position:fixed; left: 50%; margin-left:-125px; top:150px; animation: fall 1.5s ease-in, swing 4s ease-in-out; -webkit-animation: fall 1.5s ease-in, swing 4s ease-in-out; -moz-animation: fall 1.5s ease-in, swing 4s ease-in-out; } @-moz-keyframes fall{ 0% {top: -50px;} 100% {top: 150px;} } @-webkit-keyframes fall{ 0% {top: -50px;} 100% {top: 150px;} } @-moz-keyframes swing{ -moz-transform-origin: center top; 0%{-moz-transform:rotate(-3deg)} 50%{-moz-transform:rotate(-2deg)} 100%{-moz-transform:rotate(-3deg)} } @-webkit-keyframes swing{ -webkit-transform-origin:center top; 0%{-webkit-transform:rotate(-3deg)} 50%{-webkit-transform:rotate(-2deg)} 100%{-webkit-transform:rotate(-3deg)} }
check this fiddle
Comments
Post a Comment