xxxxxxxxxx
91
/* ----------------------------
HI Y'ALL THIS IS LIKE A TESTING SPACE FOR MESSING AROUND
THE SONGS IN HERE ARE DOWNLOADED FROM THE INTERNET (WELL FROM BANDCAMP
SO NOT AS ILLEGAL) PLEASE GO LISTEN TO THESE FROM THEIR RESPECTIVE AUTHOR
PLATFORM AFTER YOU'RE DONE HERE.
P.S. I SHARED THIS TO LIKE 4 PEOPLE SO IDK WHERE YOU EVEN CAME FROM
------------------------------- */
/* ----- change song here ----- */
let songPlay = 0;
/* ---------------------------- */
let songList = [
['Naircat - Hypobolic','test.mp3', 50],
['Frums - memoryfactory.lzh','test2.mp3',36],
['Frums - dropdead','test3.mp3',72],
];
let marqueePos=0;
function preload() {
font = loadFont('inconsolata.ttf');
music2 = loadSound(songList[songPlay][1])
}
function setup() {
marqueeText = 'Now Playing : ' + songList[songPlay][0]
createCanvas(500,500);
eye = createGraphics(500, 500);
amplitude = new p5.Amplitude();
}
function draw() {
if (!music2.isPlaying()){
music2.play();
} else{
music2.onended(musicEnd);
}
let level = amplitude.getLevel();
let wakefulnessN = map(level, 0, 0.5, -800, 250,true);
let bopping = map(frameCount % songList[songPlay][2], 0, songList[songPlay][2], -10, 10);
let wakefulnessBG = map(level, 0, 0.5, 40, 20);
background(wakefulnessBG, wakefulnessBG, wakefulnessBG);
//border
stroke('white')
strokeWeight(5)
noFill()
rect(25,25,450,450)
///marqueemoo -w-
noStroke()
fill(250,250,250)
rect(0, 430,windowWidth,500)
fill(0);
textFont(font);
textSize(30);
text(marqueeText, marqueePos, 475);
marqueePos-=3;
if (marqueePos < -textWidth(marqueeText)){
marqueePos = 600;
}
/// draw eye
//draw pupil
eye.stroke('white');
eye.strokeWeight(10);
eye.fill(255);
eye.ellipse(250, 240+bopping, 150, (wakefulnessN/6));
eye.noFill();
//draw lowerlid
eye.curve(0,-wakefulnessN,75,227+bopping,425,227+bopping,500,-wakefulnessN+bopping)
//draw upperlid
eye.curve(0,wakefulnessN/2,75,227+bopping,425,227+bopping,500,(wakefulnessN/2)+bopping)
//debug
textSize(20);
fill('white')
text(wakefulnessN,50,80)
text(level,50,60)
//render
image(eye, 0, 0);
eye.clear()
}
function musicEnd(){
eye.fill(255,0,0);
eye.rect(0,0,500,500)
}