We are about to switch to a new forum software. Until then we have removed the registration on this forum.
It works with a rect or a ellipse but it doesn't with a triangle. Why?
float shapeScale=1;
float speedScale=1.1;
void setup() {
size(500, 500);
frameRate(60);
}
void draw() {
shapeScale = shapeScale + speedScale;
background(0);
pushMatrix();
//translate(width/2, height/2);
scale(shapeScale);
triangle(700, 700, 850, 430, 1000, 700);
popMatrix();
if (shapeScale>=50.0 || shapeScale<=0) {
speedScale= speedScale*-1;
}
}
Answers
It's not clear what you are trying to do. Can you show us the rectangle and ellipse that work?
@jkr137 --
Your triangle is drawn using a coordinate system that is far off the screen -- even before you begin scaling. You want 0,0 to be in the center of your triangle. That means that an equal number of your coordinates should be negative and positive.
Think carefully about how centering around 0,0 works with rectangle, ellipse, and triangle -- each is drawn differently.