JS Animation Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

JS Animation Question

Hey everybody, I'm working on a game in Code Playground. I can't tell you much yet, but I had a question. You the simple box animation Sololearn taught at the end of their JS course? Is there a way to get an animation to only play if a button is clicked? Please answer in the comments below. Thanks ahead of time!

7th Mar 2017, 2:09 PM
Caleb Jore
Caleb Jore - avatar
3 Answers
+ 10
I'll give it a try @Mejer Jebali
7th Mar 2017, 2:30 PM
Caleb Jore
Caleb Jore - avatar
+ 9
@Mejer it just says that the function isn't defined.
8th Mar 2017, 1:53 PM
Caleb Jore
Caleb Jore - avatar
+ 3
Put your animation inside a js funtion "myFunction" Then call it with onclick event on html <button onclick="myFunction()">Click me</button>
7th Mar 2017, 2:27 PM
Meher Jebali
Meher Jebali - avatar