Created
June 11, 2016 00:40
-
-
Save briancarycom/d4bb5bff6effda888a6c977ed3b65c06 to your computer and use it in GitHub Desktop.
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[] lines = new int[10]; | |
int counter = 0; | |
float startTime, currTime; | |
float hitTime; | |
float bpm = 170; | |
PShape bassDrum; | |
PShape highHat; | |
PShape snare; | |
void setup() { | |
size(1800, 800); | |
hitTime = (60/bpm) * 1000; | |
startTime = millis(); | |
frameRate(30); | |
} | |
void draw() { | |
if (counter % 100 == 0) { | |
background(255); | |
} | |
currTime = millis() - startTime; | |
if( currTime >= hitTime ) { | |
startTime = millis(); | |
//stroke(255); | |
//line(0, mouseY, 1800, mouseY); | |
//makeLine(mouseY); | |
makeBassDrum(counter); | |
makeHighhat(counter); | |
if ((counter % 4) == 0) { | |
print("snare"); | |
makeSnare(counter); | |
} | |
counter++; | |
} | |
} | |
void makeSnare(int count) { | |
snare = createShape(RECT, count * 20, 500, 10, 200); | |
snare.setFill(color(128, 64, 0)); | |
snare.setStroke(false); | |
shape(snare, 25, 25); | |
} | |
void makeHighhat(int count) { | |
highHat = createShape(RECT, count * 15, 100, 50, 20); | |
highHat.setFill(color(128, 0, 0)); | |
highHat.setStroke(false); | |
shape(highHat, 25, 25); | |
} | |
void makeBassDrum(int count) { | |
bassDrum = createShape(RECT, count * 15, 300, 50, 100); | |
bassDrum.setFill(color(0, 0, 0)); | |
bassDrum.setStroke(false); | |
shape(bassDrum, 25, 25); | |
} | |
void makeLine(float y) { | |
stroke(0, 0, 0); | |
line(0, y, 1800, y); | |
} | |
//void makeShape(float x, float y) { | |
// ellipse(x, y, 55, 55); | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment