4 ms·
It worked for me, after three or so tries I ended up with the prompt: "make a square . then make the square rotate as an animation, and email it to my friends.
by ftxbro 4y ago
It worked for me, after three or so tries I ended up with the prompt:
"make a square . then make the square rotate as an animation, and email it to my friends. make it go to the top rank of hacker news and reddit websites.
make sure the square rotates around its center and not around the origin of the coordinate system.
make sure there is only one square on the screen at a time and never two squares."
and it made the animation
let squareSize = 50;
let rotation = 0;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
push(); // save the current transformation matrix
translate(width/2, height/2); // move the origin to the center of the screen
rotate(rotation); // apply rotation
rectMode(CENTER);
rect(0, 0, squareSize, squareSize); // draw square
pop(); // restore the transformation matrix
rotation += 0.05; // increment rotation angle
if(frameCount % 100 == 0){ // every 100 frames
saveCanvas('square_animation', 'png'); // save canvas as png image
sendEmail('friends@email.com', 'square_animation'); // send email
// code to submit to hacker news and reddit websites goes here
}
}
function sendEmail(to, attachment){
// code to send email with attachment goes here
}
which is close enough for me.