We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there, I am fairly new to coding and am trying to create a simple animation. I have a rectangle slowly getting larger but everything coded below that rectangle also gets larger.
float a = 1.0;
void setup()
{
size(500, 500);
frameRate(25);
smooth();
rectMode(CENTER);
ellipseMode(CENTER);
}
void draw()
{
background(0);
a = a + 0.01;
translate(width/2, height/2);
fill(0,255,0);
scale(a);
rect(0,0,200,200);
fill(255,0,0);
ellipse(0,0,100,100);
}
I think it is just a simple problem with my draw structure but basically I don't want the ellipse to take on any of the rectangles properties, in this case scale. Thanks for your help.
Answers
Just use pushMatrix() to save a transformation. Then popMatrix() to return to its previous form! :bz
Or even resetMatrix() to get default transformation back! =:)