Ejemplos Rotar

Rotar

La función rotate() rota el sistema de coordenadas actual respecto del origen actual.

Nota que por defecto el origen se ubica en la esquina superior izquierda del lienzo. Para poder rotar alrededor del centro del lienzo, tenemos primero que trasladar el sistema de coordenadas y luego rotar respecto del nuevo origen.

Las funciones push() y pop() guardan y restauran el sistema de coordenadas, respectivamente.

Creative Commons BY-NC-SA license badge

Rotar: Revised by Darren Kessner. Edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.

You can find the code history of these examples here: 2023 code, pre-2023 code. You can suggest improvements by contributing to the current website!