xxxxxxxxxx
92
// setting variables
let x1=20;
let x2 = 560;
let x3 = 20
let speedX=1.25;
// creating array for circles
let memories = [];
function setup() {
createCanvas(500, 500);
//circle animation
for(let i=0;i<700;i++){
memories[i] = new Memory (250,400);
}
}
//setting background
function draw() {
background('#00124c');
noFill();
stroke (10);
strokeWeight (1);
//using loops to create lines for balls
for (let y=0; y<=300; y+=80){
fill('#554c9b')
rect (0, y, 500, 20);
}
//creating balls moving on lines (one after another)
fill('#ffdf00')
stroke ('#FFF7AE')
strokeWeight (7)
//first row of balls
ellipse (x1,50,52);
ellipse (x1-60, 50, 52);
ellipse (x1-120, 50, 52)
x1=x1+speedX;
//second row of balls
if (x1>=560){
fill ('#c21c00');
stroke ('rgb(248,75,75)')
ellipse (x2, 130, 52);
x2 = x2-speedX;
}
//third row of balls
if (x2<=-60){
fill ('#2A63EC')
stroke ('rgb(128,128,254)')
ellipse (x3, 210, 52)
ellipse (x3-60, 210, 52)
ellipse (x3-120, 210, 52)
x3=x3+speedX;
}
//performing functions for an array
for(let i=0;i<memories.length;i++){
memories[i].display();
memories[i].move();
}
//creating image of happiness from Inside out
stroke('#00124c')
fill (255, 223, 0, 300);
triangle (380,440,420,450,380,480);
fill (255, 223, 0, 300);
triangle (420,440,460,450,450,490)
fill (111, 211, 125, 300 );
triangle (430,320,370,450,480,470);
fill (42, 99,236, 300);
triangle (490, 280, 430,285, 460, 340);
fill (255, 223, 0, 300);
circle (430,320,70);
//creating a text line
let s = 'CREATE YOUR CORE MEMORIES TODAY';
noStroke()
fill('#554c9b');
strokeWeight (10);
textSize(18) ;
textStyle(BOLD);
textFont ('Helvetica');
text (s, 30, 280, 200,200);
}