Created
September 22, 2016 22:05
-
-
Save nataliefreed/13df4663e6cd924a72e56ba1d02c282f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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