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

69
Views
Smooth rotation with second

I was wondering if there is any way to make a smoother rotation of the circle?

This is what I have so far:

  let angle = 0;
  let pointCount = 12;
  let speed;
  strokeWeight(60);

  rotate(second());
  for(let i = angle; i < radians(360 + angle) ; i += radians(360 / pointCount)){
    let x = width / 2 * Math.cos(i);
    let y = width / 2 * Math.sin(i);
    point(x, y)
  }

The rotation jumps every second, but I would like it to move smoothly.

I used rotate because I think it would be the most simple way, but if it's inconvenient please let me know if I should try something else.

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

0

Use the millis() function:

Returns the number of milliseconds (thousandths of a second) since starting the sketch [...]

The default unit of the rotate() angel is radians. If you want a complete ture every second, you have to scale the number of milliseconds by 2*PI / 1000:

rotate(millis() * 2*PI / 1000);
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!