I am trying to create a coin animation, such as an animation in a temple run using css3 and javascript. I tried to replicate the animation using the transition in css3, but I cannot achieve the same
Are they any example that has the same animation on the Internet? or can someone help me achieve the animation.
Update
When I click a button, I want some coins to exit the button and be collected in a basket (buttons can be anywhere on the page, and the basket is installed at the bottom)
Achieved using css3 transitions and jquery
Html
<button id="btn1">button1</button> <div id="1" class="coin"></div> <div id="2" class="coin"></div> <div id="3" class="coin"></div> <div id="4" class="coin"></div> <div id="basket"></div> </div>
Css
.coinanim{ top:420px; left: 430px; width:50px; height:50px; transition: all 2s ease-in-out; -webkit-transition: all 2s ease-in-out; transition-delay: .36s; -webkit-transition-delay: .36s; }
Jquery
$('#btn1').click(function(){ $('.coin').css('opacity',1); $('#1').addClass('coinanim1'); $('#2').addClass('coinanim2'); $('#3').addClass('coinanim3'); $('#4').addClass('coinanim4'); }); $('.coin').on('webkitTransitionEnd',function(){ $('.coin').css('opacity',0); $('.coin').attr('class','coin'); });
demo: http://jsfiddle.net/dA42n/23/

source share