xxxxxxxxxx
var xCoord, yCoord, changeX, changeY, img, img2, color1, color2, color3, color4, color5, color6, color7, color8, color9, color10, color11, color12, colorr, count;
function setup() {
createCanvas(windowWidth, windowHeight);
xCoord=(windowWidth/2)-250;
yCoord=220;
changeX=1;
changeY=2;
img=loadImage('imageedit_28_2914314080.png');
img2=loadImage('tv.png');
color1=random(256);
color2=random(256);
color3=random(256);
color4=random(256);
color5=random(256);
color6=random(256);
color7=random(256);
color8=random(256);
color9=random(256);
color10=random(256);
color11=random(256);
color12=random(256);
colorr=255;
count=2;
frameRate(30);
}
function draw() {
background(255);
strokeWeight(0);
//colored panels
fill(color1, color2, color3);
rect(0, 0, (windowWidth/4), windowHeight);
fill(color4, color5, color6);
rect(windowWidth/4, 0, windowWidth/4, windowHeight);
fill(color7, color8, color9);
rect(windowWidth-(windowWidth/4), 0, windowWidth/4, windowHeight);
fill(color10, color11, color12);
rect(windowWidth-(windowWidth/4)*2, 0, (windowWidth/4), windowHeight);
fill(0, 0, colorr);//blue screen
rect((windowWidth/2)-280, (windowHeight/2)-180, 510, 390);
image(img, xCoord, yCoord, 90, 40);
image(img2, (windowWidth/2)-300, (windowHeight/2)-200, 568, 413);
if ((yCoord<(windowHeight/2)-150) || (yCoord>(windowHeight/2)+120)) {
changeY=changeY*-1;
color1=random(256);
color2=random(256);
color3=random(256);
color4=random(256);
color5=random(256);
color6=random(256);
color7=random(256);
color8=random(256);
color9=random(256);
color10=random(256);
color11=random(256);
color12=random(256);
}
if ((xCoord<(windowWidth/2)-250) || (xCoord>(windowWidth/2)+30)) {
changeX=changeX*-1
color1=random(256);
color2=random(256);
color3=random(256);
color4=random(256);
color5=random(256);
color6=random(256);
color7=random(256);
color8=random(256);
color9=random(256);
color10=random(256);
color11=random(256);
color12=random(256);
}
if (count%2==0) {
colorr=0;
frameRate(10);
background(random(255), random(255), random(255));
rect((windowWidth/2)-280, (windowHeight/2)-180, 510, 390);
image(img2, (windowWidth/2)-300, (windowHeight/2)-200, 568, 413) //tv
}
else {
colorr=255;
frameRate(30);
}
xCoord=xCoord+changeX;
yCoord=yCoord+changeY;
}
function mouseClicked() {
count=count+1
}