Skip to content

Instantly share code, notes, and snippets.

@nataliefreed
Created September 22, 2016 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nataliefreed/13df4663e6cd924a72e56ba1d02c282f to your computer and use it in GitHub Desktop.
Save nataliefreed/13df4663e6cd924a72e56ba1d02c282f to your computer and use it in GitHub Desktop.
//Scale your shapes up without them moving all over the place!
var scalingFactor = 1;
var x = 100;
var y = 200;
var w = 40;
var h = 30;
function setup()
{
createCanvas(500, 500);
noFill();
for(var i=0;i<10;i++)
{
push();
translate(-x*(scalingFactor-1), -y*(scalingFactor-1));
// translate(-w*scalingFactor/2, -h*scalingFactor/2); //add this line to grow from center
scale(scalingFactor);
rect(x, y, w, h);
pop();
scalingFactor += 1;
}
}
function draw() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment