Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

71
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda