Hey everyone,
I am working on a project for university and there is one thing in p5js where I don't know how to do it.
I want to move two rectangles from the same place to two different places. (Because I like to move later lots of rectangles I want to create a loop and put the x and y values in a array.
Thank you
Annika
This is my js-code in p5js:
var demos = {x:300, y:-30};
var placeX = [0,200];
var placeY = [10,300];
var i = 0;
function setup() {
createCanvas(400, 400);
for(i=0; i<2;i++){
var tween = new TweenMax(demos, 1, {x:placeX, y:placeY, ease:Power1.easeOut});
}
}
function draw() {
background(220);
fill(200,20,150);
noStroke();
for(i=0; i<2;i++){
rect(demos.x, demos.y, 30, 30);
}
}