class Timeline{ float lineY; float interval; int lastMillis; int y; int x; int w; int panLineX; color strokeColor = 50; boolean isPlaying = false; public Timeline(int _x, int _w){ x = _x; w = _w; y = 0; lineY = height/2; interval = 40; lastMillis = 0; panLineX = x+(w/2); } void update(){ drawSpace(); drawPanLine(); drawTimeLine(); displayText(); } void drawSpace(){ fill(255, 20); noStroke(); rectMode(CORNER); rect(x, y, w, height); } void drawPanLine(){ stroke(strokeColor); for(int i=0; i3){ point(panLineX, i); } } } void drawTimeLine(){ stroke(strokeColor); line(x, lineY, x+w, lineY); if(isPlaying){ if(millis()-lastMillis>=interval){ lineY--; if(lineY<=0){ lineY= height; } lastMillis = millis(); } } } void play(){ isPlaying = true; } void stop(){ isPlaying = false; } void displayText(){ fill(strokeColor); textAlign(CENTER); text("L", panLineX-20, 20); text("R", panLineX+20, 20); } void setInterval(float _interval){ interval = _interval; } }