Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite+ 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!
2 Réponses
+ 9
<!-- Sure. Here is the HTML: -->
<button id="button_right" class="buttons" onclick="moveRight">〉</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 :)