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

105
Vistas
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 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