xxxxxxxxxx
283
let sunX, sunY;
let x=0,y=0;
let hiker = 0;
let speed=1;
let steep =.25;
let startHikeX;
let legX, legY, legX2,legY2;
let sun;
let randR;
let randG;
let randB;
function setup() {
createCanvas(600, 500);
colorMode(RGB);
randR = random(200,255);
randG = random(170,220);
randB = random(0,50);
/*sun = {
stroke(randR, randG, randB);
strokeWeight(8);
fill(255, 192, 0);
}*/
}
function draw() {
angleMode(DEGREES);
ellipseMode(CENTER);
sunX = mouseX;
sunY = map(mouseX,0,width,360,0);
//map backgrounds to mouseX
//red to blue
redR= map(mouseX,0,width,235,135);
redG= map(mouseX,0,width,83,206);
redB= map(mouseX,0,width,62,235);
//orange to blue
orangeR = map(mouseX,0,width,235,135);
orangeG= map(mouseX,0,width,126,206);
orangeB = map(mouseX,0,width,62,235);
//light orange to blue
lightOrangeR = map(mouseX,0,width,235,135);
lightOrangeG= map(mouseX,0,width,169,206);
lightOrangeB= map(mouseX,0,width,62,235);
//yellow to blue
yellowR= map(mouseX,0,width,235,135);
yellowG= map(mouseX,0,width,212,206);
yellowB= map(mouseX,0,width,62,235);
//light purple to blue
lightPurpleR= map(mouseX,0,width,172,135);
lightPurpleG=map(mouseX,0,width,131,206);
lightPurpleB=map(mouseX,0,width,242,235);
//purple to blue
purpleR=map(mouseX,0,width,126,135);
purpleG=map(mouseX,0,width,62,206);
purpleB=map(mouseX,0,width,235,235);
//stars fade
starFadeA = map(mouseX,400,width,100,0)
//dark purple sky
noStroke();
background(purpleR,purpleG,purpleB);
//light purple
fill(lightPurpleR,lightPurpleG,lightPurpleB);
rect(0,55,width,100);
//yellow sky
fill(yellowR, yellowG, yellowB);
rect(0,110,width,100);
// light orange sky
fill(lightOrangeR, lightOrangeG, lightOrangeB);
rect(0,165,width,100);
//orange sky
fill(orangeR, orangeG, orangeB);
rect(0,220,width,200);
//red sky
fill(redR, redG, redB);
rect(0,280,width,150);
//stars
let randomStar=0;
let star =0;
stroke(255,255,255,starFadeA);
strokeWeight(3);
/*for (x=0; x<width; x++){
point(star,random);
randomStar = map(star,0,height,width,55);
}*/
point(15,25);
point(39,39);
point(75,15);
point(69,32);
point(85,39);
point(119,8);
point(129,48);
point(135,5);
point(149,30);
point(175,21);
point(199,12);
point(209,44);
point(215,25);
point(242,13);
point(255,15);
point(269,38);
point(329,41);
point(330,19);
point(349,34);
point(345,17);
point(359,12);
point(399,44);
point(442,43);
point(455,35);
point(469,18);
point(429,21);
point(437,9);
point(509,14);
point(545,17);
point(559,42);
point(599,44);
point(459,36);
point(480,49);
point(379,24);
point(245,47);
point(550,39);
point(589,30);
//Two tone sun
stroke(230, 192, 0);
strokeWeight(8);
fill(255, 192, 0);
//sun.fill;
//sun.strokeWeight;
//sun.stroke;
ellipse(sunX,sunY,70);
//Green grass
//fill(50,205,50);
fill( 119, 153, 136);
noStroke();
quad(0,500,0,400,600,250,600,500);
stroke(45,185,45);
strokeWeight(6);
line(0,400,600,250)
//push();
//noLoop();
//Mountain 2.0
noStroke();
fill(199,199,199);
triangle(390,240,520,160,600,245);
//Mountain 2.1
noStroke();
fill(199,199,199);
triangle(210,240,320,110,400,260);
//Mountain 2.2
noStroke();
fill(199,199,199);
triangle(300,240,420,140,490,260);
//Mountain 2.3
noStroke();
fill(199,199,199);
triangle(95,340,220,120,350,260);
//Mountain 1.1 - Rightmost -
noStroke();
fill(169);
triangle(458,282,565,180,650,235);
//ice cap
stroke(189, 224, 255);
strokeWeight(4);
fill(240, 248, 255);
quad(546,200,565,180,580,192,558,207);
// Mountain 1.2 - Second from Right -
noStroke();
fill(169);
triangle(358,308,480,140,550,260);
//ice cap
stroke(189, 224, 255);
strokeWeight(4);
fill(240, 248, 255);
quad(460,170,480,140,501,180,475,168);
// Mountain 1.3 - Third from Right -
noStroke();
fill(169);
triangle(320,315,380,110,450,285);
//ice cap
stroke(189, 224, 255);
strokeWeight(2);
fill(240, 248, 255);
quad(376,125,380,112,383,120,381,118);
//Mountain 1.4
noStroke();
fill(169);
triangle(200,347,280,90,390,300);
//ice cap
stroke(189, 224, 255);
strokeWeight(4);
fill(240, 248, 255);
quad(271,125,280,92,292,116,281,111);
//Mountain 1.5
noStroke(200,200,200);
fill(169,169,169);
triangle(100,371,200,190,260,332);
//ice cap
stroke(189, 224, 255);
strokeWeight(4);
fill(240, 248, 255);
quad(190,212,200,188,208,210,200,205);
//Mountain 1.6
noStroke(200,200,200);
fill(169,169,169);
//fill(random,random,random);
triangle(50,385,120,140,210,345);
//ice cap
stroke(189, 224, 255);
strokeWeight(4);
fill(240, 248, 255);
quad(110,180,120,140,133,172,118,188);
//pop();
// hiker
//legs
stroke(0);
if (x > width || x < 0){
speed = speed*-1; steep=steep*-1;
}
x= x+ speed;
y= y-steep;
push();
translate(x,y);
/*legX=1.05*width;
legY=1.85*height;
legX2=1.051*width;
legY2=1.851*height;
line(legX,legY,legX2,legY2);*/
line(162,356,170,347);
line(170,347,176,352);
//body
line(170,347,172,338);
//arm
strokeWeight(3);
line(173,343,179,338);
//hand
strokeWeight(4)
point(180,339);
//pole
line(180,339,183,349);
//head
fill(0);
circle(174,331,8,8);
//backpack
fill(255);
rect(165,335,6,12);
console.log(x,y);
pop();
/*text
noStroke();
fill(0);
textStyle(BOLD);
textAlign(CENTER,BOTTOM);
textFont('Helvetica',16)
angleMode(DEGREES);
rotate(-15);
text("NICE HIKE",375,418);*/
//Clouds
//River
//Trees
//stroke(139, 69, 19);
//line(500,350)
}