Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
void setup(){
//set the size of the window
size(400,400);
smooth();
frameRate(60);
}

void draw(){
noStroke();

//draw a background
background(240-(mouseY/2),235-(mouseY/2),216-(mouseY/2));
  
//mode
ellipseMode(CENTER);
rectMode(CENTER);

//draw the waterfall
fill(240-(mouseY/6),245-(mouseY/6),249-(mouseY/6));
quad(200,180,220,180,220,400,200,400);

//draw the shelter
fill(215-(mouseY/6),215-(mouseY/6),240-(mouseY/6));
rect(175+mouseX/3,315,30,170);
  
//draw the montain (left)
fill(241-(mouseY/6),244-(mouseY/6),249-(mouseY/6));
triangle(180,20,200,80,150,70);

fill(235-(mouseY/6),235-(mouseY/6),247-(mouseY/6));
triangle(150,70,200,80,100,120);

fill(224-(mouseY/6),224-(mouseY/6),240-(mouseY/6));
triangle(200,80,190,130,100,120);

fill(214-(mouseY/6),214-(mouseY/6),232-(mouseY/6));
triangle(190,130,200,180,100,120);

fill(199-(mouseY/6),199-(mouseY/6),223-(mouseY/6));
triangle(100,120,170,260,200,180);

fill(206-(mouseY/5),206-(mouseY/5),234-(mouseY/5));
triangle(100,120,60,160,170,260);
triangle(200,180,200,300,170,260);

fill(194-(mouseY/5),194-(mouseY/5),219-(mouseY/5));
triangle(170,260,200,300,200,400);

fill(204-(mouseY/4),204-(mouseY/4),224-(mouseY/4));
triangle(170,260,200,400,110,200);

fill(172-(mouseY/4),172-(mouseY/4),198-(mouseY/4));
triangle(110,200,200,400,60,400);

fill(182-(mouseY/3),182-(mouseY/3),204-(mouseY/3));
quad(60,160,110,200,60,400,30,400);

//draw the montain(right)
fill(242-(mouseY/6),242-(mouseY/6),252-(mouseY/6));
triangle(240,20,270,60,250,80);

fill(218-(mouseY/6),218-(mouseY/6),241-(mouseY/6));
quad(270,60,250,80,220,130,300,100);

fill(235-(mouseY/6),235-(mouseY/6),245-(mouseY/6));
quad(220,130,300,100,360,180,300,180);

fill(211-(mouseY/6),211-(mouseY/6),237-(mouseY/6));
quad(300,180,360,180,280,240,220,200);

fill(205-(mouseY/5),205-(mouseY/5),232-(mouseY/5));
triangle(220,130,220,200,300,180);

fill(199-(mouseY/5),199-(mouseY/5),223-(mouseY/5));
triangle(220,200,220,270,280,240);

fill(207-(mouseY/4),207-(mouseY/4),230-(mouseY/4));
triangle(280,240,220,270,260,400);

fill(217-(mouseY/3),217-(mouseY/3),238-(mouseY/3));
triangle(220,270,220,400,260,400);

fill(227-(mouseY/3),227-(mouseY/3),247-(mouseY/3));
quad(360,180,380,200,270,320,280,240);

fill(212-(mouseY/3),212-(mouseY/3),237-(mouseY/3));
triangle(330,250,270,320,260,400);

fill(186-(mouseY/3),186-(mouseY/3),219-(mouseY/3));
triangle(330,250,260,400,380,400);

fill(173-(mouseY/3),173-(mouseY/3),209-(mouseY/3));
triangle(330,250,380,400,380,200);


//draw the glass container
fill(142-(mouseY/5),159-(mouseY/5),188-(mouseY/5));
triangle(160+mouseX/3,230,140+mouseX/3,240,170+mouseX/3,260);

fill(171-(mouseY/5),185-(mouseY/5),207-(mouseY/5));
triangle(160+mouseX/3,230,190+mouseX/3,230,170+mouseX/3,260);

fill(220-(mouseY/5),232-(mouseY/5),252-(mouseY/5));
triangle(140+mouseX/3,240,150+mouseX/3,250,160+mouseX/3,240);

fill(186-(mouseY/5),203-(mouseY/5),231-(mouseY/5));
triangle(150+mouseX/3,250,160+mouseX/3,240,170+mouseX/3,260);

fill(205-(mouseY/5),219-(mouseY/5),242-(mouseY/5));
triangle(160+mouseX/3,240,170+mouseX/3,260,180+mouseX/3,240);

fill(157-(mouseY/5),175-(mouseY/5),205-(mouseY/5));
triangle(180+mouseX/3,240,190+mouseX/3,230,170+mouseX/3,260);


//draw the island(left)
fill(112-(mouseY/5),103-(mouseY/5),108-(mouseY/5));
quad(30,240+mouseY/10,10,260+mouseY/10,60,290+mouseY/10,100,240+mouseY/10);
triangle(100,240+mouseY/10,60,290+mouseY/10,110,280+mouseY/10);
triangle(100,240+mouseY/10,110,280+mouseY/10,170,250+mouseY/10);
quad(170,250+mouseY/10,110,280+mouseY/10,170,290+mouseY/10,190,260+mouseY/10);

fill(177-(mouseY/3),155-(mouseY/3),143-(mouseY/3));
quad(10,260+mouseY/10,50,310+mouseY/10,70,330+mouseY/10,60,290+mouseY/10);

fill(181-(mouseY/4),173-(mouseY/4),166-(mouseY/4));
triangle(70,330+mouseY/10,60,350+mouseY/10,110,330+mouseY/10);

fill(199-(mouseY/4),192-(mouseY/4),186-(mouseY/4));
quad(70,330+mouseY/10,60,290+mouseY/10,110,280+mouseY/10,110,330+mouseY/10);

fill(163-(mouseY/4),155-(mouseY/4),148-(mouseY/4));
triangle(110,330+mouseY/10,60,350+mouseY/10,80,370+mouseY/10);

fill(185-(mouseY/4),178-(mouseY/4),172-(mouseY/4));
triangle(110,280+mouseY/10,110,330+mouseY/10,170,290+mouseY/10);

fill(160-(mouseY/4),152-(mouseY/4),146-(mouseY/4));
triangle(110,330+mouseY/10,170,290+mouseY/10,130,340+mouseY/10);

fill(140-(mouseY/4),133-(mouseY/4),126-(mouseY/4));
triangle(110,330+mouseY/10,130,340+mouseY/10,80,370+mouseY/10);

fill(161-(mouseY/4),141-(mouseY/4),130-(mouseY/4));
triangle(50,310+mouseY/10,70,330+mouseY/10,60,350+mouseY/10);


//draw the island(right)
fill(127-(mouseY/5),117-(mouseY/5),123-(mouseY/5));
triangle(290,280+mouseY/40,320,290+mouseY/40,320,250+mouseY/40);
quad(320,290+mouseY/40,320,250+mouseY/40,390,250+mouseY/40,370,290+mouseY/40);
triangle(390,250+mouseY/40,400,260+mouseY/40,370,290+mouseY/40);

fill(191-(mouseY/4),183-(mouseY/4),177-(mouseY/4));
triangle(290,280+mouseY/40,320,290+mouseY/40,300,320+mouseY/40);

fill(173-(mouseY/4),162-(mouseY/4),152-(mouseY/4));
triangle(320,290+mouseY/40,300,320+mouseY/40,360,330+mouseY/40);

fill(163-(mouseY/4),150-(mouseY/4),139-(mouseY/4));
triangle(300,320+mouseY/40,360,330+mouseY/40,330,350+mouseY/40);

fill(160-(mouseY/4),145-(mouseY/4),132-(mouseY/4));
triangle(330,350+mouseY/40,360,330+mouseY/40,370,370+mouseY/40);

fill(144-(mouseY/4),132-(mouseY/4),121-(mouseY/4));
triangle(360,330+mouseY/40,380,320+mouseY/40,370,370+mouseY/40);

fill(199-(mouseY/4),192-(mouseY/4),186-(mouseY/4));
triangle(320,290+mouseY/40,370,290+mouseY/40,360,330+mouseY/40);

fill(150-(mouseY/4),129-(mouseY/4),117-(mouseY/4));
quad(370,290+mouseY/40,360,330+mouseY/40,380,320+mouseY/40,400,260+mouseY/40);


//draw the forest
fill(81-(mouseY/8),72-(mouseY/8),91-(mouseY/8));
triangle(90,40+mouseY/10,130,230+mouseY/10,50,230+mouseY/10);
ellipse(90,230+mouseY/10,80,30);

fill(212-(mouseY/3),191-(mouseY/3),208-(mouseY/3));
triangle(60,70+mouseY/10,90,260+mouseY/10,30,260+mouseY/10);
ellipse(60,260+mouseY/10,60,20);

fill(147-(mouseY/4),125-(mouseY/4),138-(mouseY/4));
triangle(130,60+mouseY/10,150,250+mouseY/10,110,250+mouseY/10);
ellipse(130,250+mouseY/10,40,10);

fill(199-(mouseY/4),176-(mouseY/4),197-(mouseY/4));
triangle(160,120+mouseY/10,170,260+mouseY/10,150,260+mouseY/10);
ellipse(160,260+mouseY/10,20,5);

fill(164-(mouseY/4),138-(mouseY/4),153-(mouseY/4));
triangle(370,130+mouseY/40,392,260+mouseY/40,348,260+mouseY/40);
ellipse(370,260+mouseY/40,44,20);

//draw the magic cube
fill(176-(mouseY/3),176-(mouseY/3),204-(mouseY/3));
quad(320,sin(frameCount/12)*3+260,300,sin(frameCount/12)*3+240,320,sin(frameCount/12)*3+220,340,sin(frameCount/12)*3+240);

fill(143-(mouseY/3),143-(mouseY/3),171-(mouseY/3));
quad(320,sin(frameCount/12)*3+220,340,sin(frameCount/12)*3+240,350,sin(frameCount/12)*3+230,330,sin(frameCount/12)*3+210);

fill(187-(mouseY/3),187-(mouseY/3),218-(mouseY/3));
quad(310,sin(frameCount/15)*3+210,290,sin(frameCount/15)*3+190,310,sin(frameCount/15)*3+170,330,sin(frameCount/15)*3+190);

fill(149-(mouseY/3),149-(mouseY/3),182-(mouseY/3));
quad(290,sin(frameCount/15)*3+190,290,sin(frameCount/15)*3+200,310,sin(frameCount/15)*3+220,310,sin(frameCount/15)*3+210);

fill(120-(mouseY/3),120-(mouseY/3),151-(mouseY/3));
quad(310,sin(frameCount/15)*3+210,310,sin(frameCount/15)*3+220,330,sin(frameCount/15)*3+200,330,sin(frameCount/15)*3+190);

}


void mousePressed(){
println("stary night on sky montain");

//draw the lightning
fill(249,245,142);
quad(180,0,230,0,240,80,210,80);
quad(210,80,200,130,210,130,240,80);
triangle(200,130,210,170,210,130);

//draw the stars
stroke(249,245,142);
line(20,50,40,50);
line(30,40,30,60);
line(20,40,40,60);
line(40,40,20,60);

line(90,20,90,40);
line(80,20,100,40);
line(80,30,100,30);
line(80,40,100,20);

line(320,30,320,50);
line(310,30,330,50);
line(310,40,330,40);
line(310,50,330,30);

line(360,80,360,100);
line(350,80,370,100);
line(350,90,370,90);
line(350,100,370,80);

}