# Jdbrown – Project 10 – Magic

I took a rather simple approach to this project – none of the ideas I came up with was more interesting than this experiment that I made:

``````// Joshua Brown
// Jdbrown@andrew.cmu.edu
// Section C
// Project 10 - Landscape

// Joshua Brown
// Jdbrown@andrew.cmu.edu
// Section C
// Project 10 - Landscape

// Simple demonstration of the noise() function.
// Change these for different effects:

var terrainSpeed = 0.0005;
var terrainDetail = 0.005;
var i;

function setup() {
createCanvas(480, 480);
frameRate(30);
}

function draw() {

background(255);
beginShape();
fill(0, 100);

for (var i = 0; i < width; i++) {
var t = (i * terrainDetail) + (millis() * terrainSpeed);
var y = map(noise(t), 0, 1, 0, height);
vertex(i, y + 200);
}

for (var i = 0; i < width; i++) {
fill (0);
var t = (i * terrainDetail) + (millis() * terrainSpeed);
var y = map(noise(t), 0, -1, 0, height);
vertex(i, y + 400);
fill(0, 10)
noStroke();
rect (i, y + 800, i, y + 100);
}

endShape();
drawSun();
}

function drawSun() {
// making the sun and its lines

var S = second();
var H = hour();
var M = minute();

//drawLines();

push ();
stroke (255);
strokeWeight (2.5);
translate (width, 0);
fill (0, 0);

fill (255, 100, 120);
ellipse (0, 0, 200 + (H * 3), 200 + (H * 3));   // draws the sun
fill (255);
ellipse (0, 0, S + 75, S + 75);     // draws the white ball in the sun, growing every second
pop ();

push ();
stroke (255);
strokeWeight (1.5);
translate (width, 0);
fill (0, 0);
fill (200, 180, 70);
pop ();

push ();
stroke (255);
strokeWeight (1);
translate (width, 0);