Making a perfect spinning triangle

edited July 2017 in Questions about Code

Heyo, So I'm new and having trouble making a triangle that spins from the center and all. I want to make a little animated fidget spinner so I'm starting with a triangle. Here's my code so far but the triangle seems good when it's right way up but when it spins it's obviously not and it's late and I can't figure it out.

Thanks.

float velocity = 0.01; float spin = 0;

void setup(){ size(500,500);

}

void draw(){ background(255);

spin += velocity; pushMatrix(); translate(width/2, height/2); noStroke(); fill(0); rotate(spin); triangle(0,-100, 100, 50,-100,50); popMatrix(); noStroke(); fill(255,0,0); ellipse(width/2, height/2, 5, 5);

}

Answers

Sign In or Register to comment.