Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
How i can make onclick to start animation

I got requestAnimationFrame(loop); and I'm trying to make onclick button to start animation, once you press it animation starts, I got button figured out <button type="start" form="form1" value="start onclick="start()">start</button> But i cannot figure out how to make it into a script.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

If you want to call requestAnimationFrame(loop) you should do it like this...

<button type="start" form="form1" value="start" onclick="requestAnimationFrame(loop)">start</button>
about 4 years ago · Juan Pablo Isaza Report

0

Here is a snippet example :

<button onclick="start()">start</button>
<script>
   var animId=false;
   function start() {
      animId=requestAnimationFrame(loop);
   }
   function loop() {
      //your code here
   }
   // I added this in case you wanted to call a stop
   function stop() {
      animId && cancelAnimationFrame(animId);
   }
</script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!