Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

70
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda