This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//position clouds horizontally across the sky | |
for(horiz = -100; horiz <= width+100; horiz += 200){ | |
//position clouds vertically along top 40% of sky | |
for(vert = -50; vert <= height*0.60; vert += 120){ | |
//creating the cloud shape | |
for (i = -20; i <= 20; i += 20) { | |
fill(230, 237, 235, 170); | |
//r1 and r2 are random numbers that make the clouds different each time the sketch is run | |
ellipse(cloud.x+i+horiz, cloud.y+vert, r1, r2); | |
ellipse(cloud.x+5+horiz, cloud.y+i+vert, r1, r2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//move clouds | |
cloud.x += 0.5; | |
//loop clouds | |
if (cloud.x > width/3){ | |
cloud.x = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ellipse(cloud.x, cloud.y, 50, 40); | |
ellipse(cloud.x+20, cloud.y-20, 30, 30); | |
ellipse(cloud.x+30, cloud.y+20, 50, 40); | |
ellipse(cloud.x+40, cloud.y, 60, 30); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//only change the color when not dragging and when it passes the stop angle | |
if (mouseAngle >= stopAngle || !dragging) { | |
changeCol = false; | |
} else { | |
changeCol = true; | |
} | |
//when slider position hits stop angle | |
if (angle > stopAngle) { | |
//change the color | |
if (changeCol) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//all the boolean values started as false at the beginning of the sketch | |
//if slider reaches the area after the stop angle | |
if (angle > stopAngle || angle < 0) { | |
//reset arc rotation | |
angle = 0; | |
//define when to change color | |
//if hasn't passed the stop angle before | |
if (!passedStop) { | |
//flip boolean value | |
changeCol = !changeCol; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let i = 0; i < height + 20; i += 20) { | |
for (let m = 0; m < x + 20; m += 20) { | |
if (colorOn){ | |
r = random (100, 240); | |
g = random (100, 240); | |
c = random (100, 240); | |
fill(r, g, c); | |
} else { | |
fill(random(110, 220)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colorMode(HSL); | |
fill(h, s, l); | |
ellipse(a, b, 30, 30); | |
if (a >= width - 15 || a <= x + 30) { | |
directiona = -directiona; | |
h += random(20, 200); | |
} | |
if (b >= height - 15 || b <= 15) { | |
directionb = -directionb; | |
h -= random(20,70); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int LED1Pin = 4; | |
int switchPin = 7; | |
void setup(){ | |
pinMode(switchPin, INPUT); | |
pinMode(LED1Pin, OUTPUT); | |
Serial.println(switchPin); | |
} | |
void loop(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//connect LEDs based on pins | |
//the light sensor must be connected to A5 | |
int LED1Pin = 3; | |
int LED2Pin = 4; | |
int LED3Pin = 5; | |
int LED4Pin = 6; | |
void setup(){ | |
Serial.begin(9600); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
createCanvas(400, 600); | |
numLayers = 50; | |
layerHeight = height/numLayers; | |
startCol = color(177, 233, 239); | |
endCol = color(26, 33, 68); | |
colIncr = 1/numLayers; | |
} | |
function draw() { |
OlderNewer