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

108
Visualizações
Javascript canvas: How to make an object rotate only around the y axis (in 2d)

Pretty much I'm trying to make falling leaves spin while staying flat on the screen, and I made a function draw_leafs that successfuly draw the leafs but when I use rotate in the draw_leafs function to set each of them in a different starting position, it make some of them rotate out of the screen or flip in a way that we see their back, but I always want the leafs to have a front view and only spin on themselves along the plan (along the y axis).

I'm not at the animation step yet, I only want to draw the first leafs in a way that they have each a different rotation, while all facing the camera.

The way I set them a random rotation degree angle is this way:

r = Math.random() * 360 * Math.PI / 180;

I hope I made myself clear enough.

about 4 years ago · Juan Pablo Isaza
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