Animation Question | SoloLearn: Learn to code for FREE!

+8

Animation Question

I'm developing a paddleball game but the button to move the paddle. I've put the animation in a function and called it with onclick but it still won't work. Can you help? Thanks!

3/8/2017 2:19:24 PM

Caleb Jore

2 Answers

New Answer

+9

<!-- Sure. Here is the HTML: --> <button id="button_right" class="buttons" onclick="moveRight">&#12297;</button> // And here is the JS: var pos; function moveRight() { pos += 100; paddle.style.left = pos + "px"; setInterval(moveRight, 50); } // Thanks ahead of time!

+4

Can you paste the animation code for reference? I'll be able to help you more if I can see what we have to work with :)