Current File : /home/jeshor13/11bsouth.com/HonkBoard0.6/graphics.js |
function basicSign() {
fill("white")
strokeWeight(width * 0.01)
rect(width * 0.01, height * 0.01, width * 0.98, height * 0.98)
fill("black")
noStroke()
textFont(highwayFont);
textSize(ceil(sqrt(height * width)) / 10); // set largest font based on canvas area
text(headlineText, ((width * 0.50) - (textWidth(headlineText) * 0.50)), height * 0.15)
textSize(ceil(sqrt(height * width)) / 12);
text(midlineText, ((width * 0.50) - (textWidth(midlineText) * 0.50)), height * 0.285)
textSize(ceil(sqrt(height * width)) / 15)
text(bottomlineText, ((width * 0.50) - (textWidth(bottomlineText) * 0.50)), height * 0.83)
if (honkCount0 == honkCount) {
noStroke()
rect(width * 0.025, height * 0.325, width * 0.95, height * 0.425)
}
if (honkCount0 != honkCount) {
stroke(255, 204, 0)
strokeWeight(5)
rect(width * 0.025, height * 0.325, width * 0.95, height * 0.425)
stroke(0, 0, 0)
strokeWeight(0)
}
rect(width * 0.025, height * 0.85, width * 0.95, height * 0.12)
textSize(height * 0.11)
fill("green")
textAlign(CENTER);
text(int(displayHonkCount), width * 0.03, height * 0.95, width * .95)
// Sets the image on the main display depending on variable
if (displayHonkCount <= 50 && panicMode == false) {
image(lightSmile, (width * 0.25), height * 0.35, (width * 0.50), (height * 0.35));
}
if (displayHonkCount <= 50 && panicMode == true) {
image(littleSadMouth, (width * 0.25), height * 0.35, (width * 0.50), (height * 0.35));
}
if (displayHonkCount > 50 && displayHonkCount < 100 && panicMode == false) {
image(flatMouth, (width * 0.25), height * 0.35, (width * 0.50), (height * 0.35));
}
if (displayHonkCount > 50 && displayHonkCount < 100 && panicMode == true) {
image(sadFace, (width * 0.25), height * 0.35, (width * 0.50), (height * 0.35));
}
if (displayHonkCount >= 100 && panicMode == false) {
image(annoyed, (width * 0.25), height * 0.35, (width * 0.50), (height * 0.35));
}
if (displayHonkCount >= 100 && panicMode == true) {
image(deadFace, (width * 0.25), height * 0.35, (width * 0.50), (height * 0.35));
}
///
for (k = 0; k < p_spectrumMax.length; k++) {
if (p_spectrumMax[k] == 0) {
p_spectrumMax[k] = spectrum[k]
}
if (p_spectrumMax[k] <= spectrum[k]) {
p_spectrumMax[k] = spectrum[k]
}
}
}
function consoleData() {
fill(230)
rect(0, 0, width * 0.215, height)
noFill();
stroke("blue")
beginShape();
for (j = 0; j < p_spectrumAvg.length; j++) {
vertex(map(p_spectrumAvg[j], 0, 255, width * 0.20, width * 0.02), (map(j, 0, p_spectrumAvg.length, height * 0.99, height * 0.01)));
}
endShape();
stroke(0, 0, 255, 50)
beginShape();
for (j = 0; j < p_spectrumAvg.length; j++) {
vertex(map(p_spectrumAvg[j] + notHonkCeiling, 0, 255, width * 0.20, width * 0.02), (map(j, 0, p_spectrumAvg.length, height * 0.99, height * 0.01)));
}
endShape();
stroke(255, 0, 0, 50)
beginShape();
for (j = 0; j < p_spectrumAvg.length; j++) {
vertex(map(p_spectrumAvg[j] + honkFloor, 0, 255, width * 0.20, width * 0.02), (map(j, 0, p_spectrumAvg.length, height * 0.99, height * 0.01)));
}
endShape();
beginShape();
stroke('black')
for (i = 0; i < spectrum.length; i++) {
vertex(map(spectrum[i], 0, 255, width * 0.20, width * 0.02), (map(i, 0, spectrum.length, height * 0.99, height * 0.01)));
//vertex(i, map(spectrum[i], 0, 255, height, 0));
}
endShape();
fill("white")
text("Honk Count: " + ceil(displayHonkCount), width * 0.23, 20)
text("Honk like sounds: " + honkCount, width * 0.23, 40)
text("samples per Sec: " + analysiesPerTime, width * 0.23, 60)
}
function consoleSettings() {
fill("black")
rect(width * 0.215, 0, width * 0.95, height)
fill("white")
text("Honk Count: " + ceil(displayHonkCount), width * 0.23, 20)
text("Honk like sounds: " + honkCount, width * 0.23, 40)
text("samples per Sec: " + analysiesPerTime, width * 0.23, 60)
notHonkCeilingInput.show()
honkFloorInput.show()
nonHonkFeatherInput.show()
honkFeatherInput.show()
minHonkPeaksInput.show()
minNonHonkValleysInput.show()
notHonkCeilingLable.show()
honkFloorLable.show()
nonHonkFeatherLable.show()
honkFeatherLable.show()
minHonkPeaksLable.show()
minNonHonkValleysLable.show()
}
function honkDisplayNumber() {
if (millis() - displayHonkCountTimer > 1000) {
//print(honkCount)
if (whileHonks > 4) {
panicNotches++
honkCount1 = honkCount1 + 4
} else {
honkCount1 = honkCount1 + whileHonks / 4
}
displayHonkCountTimer = millis()
whileHonks = 0
}
if (panicNotches > 5){
panicMode = true
panicNotches = 0
panicTimer = millis()
}
if (millis()-panicTimer > 5000 ){
panicMode = false
}
displayHonkCount = lerp(displayHonkCount0, honkCount1, 0.05)
}