xxxxxxxxxx
71
let img1, img2, img3, img4, img5, img6;
let w;
let h
let fireworks = [];
let gravity;
function preload() {
img1 = loadImage('assets/picnic.JPG');
img2 =loadImage("assets/beach_sit.JPG");
img3 =loadImage("assets/daddy_luc.JPG");
img4 =loadImage("assets/family_smile.JPG");
img5 =loadImage("assets/beach_stand.jpeg");
img6 =loadImage("assets/chair.JPG");
}
function setup() {
w = windowWidth
h = windowHeight
createCanvas(w, h);
gravity = createVector(0, 0.2);
strokeWeight(4);
}
function draw() {
background('pink');
textSize(32)
textAlign(CENTER)
let s = "We love you!\n Happy Valentine's Day!";
let t = "You are the best and\n we love you so much!!!";
fill(228, 27, 23);
text(s, w/2 - 200, 30, 400, 200);
image(img5, w/2 - (img5.width/3)/2, 150, img5.width/3, img5.height/3)
image(img1, w - img1.width*.75, 75, img1.width*.75, img1.height*.75);
image(img2, w - (img2.width*.75), h - 350, img2.width*.75, img2.height*.75);
image(img3, w/2 - img3.width, h - 500, img3.width/2, img3.height/2);
image(img4, 0, 0, img4.width*.75, img4.height*.75);
image(img6, w/2 - 1.5*(img6.width), h - 300, img6.width/2, img6.height/2);
text(t, w/2 - 200, height - 100, 400, 200);
if (random(1) < 0.03) {
fireworks.push(new Firework());
}
for (var i = fireworks.length - 1; i >= 0; i--) {
fireworks[i].update();
fireworks[i].show();
if (fireworks[i].done()) {
fireworks.splice(i, 1);
}
}
}
// function windowResized() {
// resizeCanvas(w, h);
// print("resizing to: "+w+" "+ h);
// if (w < img2.width){
// img2copy = img2.get();
// img2Copy.resize(w,0);
// }
// }