xxxxxxxxxx
67
let FR = 10; // Frame Rate = Number of Lines in between
let shift = 9; // offset to next line
function setup() {
createCanvas(600, 600);
background(0);
frameRate(FR);
}
function draw() {
background(0,0,0,30);
// Origin = 9 : 0;
translate( shift * frameCount , 0 );
let passedSeconds = int( millis() / 1000 );
let min = 5;
let minCount = 0;
for( let i = 0; i <= passedSeconds; i++ ) {
stroke(255);
// one second = 10 Frames * distance between lines
translate( -1 * shift * FR , 0 );
minCount = minCount + 1;
if(minCount == min ){
stroke('red');
minCount=0;
}
line(shift, 50, shift, (height-50));
}
/*
let passedSeconds = int( millis() / 1000 );
console.log(passedSeconds)
for( let i = 0; i <= passedSeconds; i++ ) {
let x = i;//shift * i * FR * -1;
line(x, 50, x, (height-50));
}
*/
/*
background(0,0,0,30);
// RGBA
// alpha between 0-255 (also 255 a.k.a. 100%)
let passedSeconds = int( millis() / 1000 );
// push lines to right
translate( frameCount * shift, 0 );
for( let i = 0; i <= passedSeconds; i++ ) {
let x = shift * FR * -1 * i;
line(x, 50, x, (height-50));
}
*/
}