xxxxxxxxxx
21
// rotate rocket cursor demo from p5.js atan2 reference example
// https://editor.p5js.org/whatmakeart/sketches/lmkUPLqge
let fontSize = 32;
function setup() {
createCanvas(400, 400);
}
function draw() {
textSize(fontSize);
background(200);
translate(width / 2, height / 2);
let x = mouseX - width / 2;
let y = mouseY - height / 2;
let angle = atan2(y, x);
rotate(angle + PI / 4);
text("🚀", 0, 0);
describe('A rocket emoji at the center of the canvas rotates with mouse movements.');
}