Seizure lines [SEIZURE WARNING]
Processing.js expirmentation.
[SEIZURE WARNING]
by Giorgio Malvone
HTML
<title>Basic Processing</title>
<script id="processingcode" type="application/processing">
int speed = 1;
void setup() {
size(window.innerWidth, window.innerHeight);
stroke(255);
noCursor(); textSize(10);
}
float y = 0;
void keyPressed() {
if (keyCode == UP) {
speed = speed + 1;
}
if (keyCode == DOWN) {
speed = speed - 1;
}
if ( (keyCode == DOWN) && (speed == -1) ) {
speed = speed + 1;
}
}
void mousePressed()
{
speed = speed + 1;
}
void draw(){
background(0);
fill(#fd8989);
text("Speed: ",10,21);
text("Click to increase speed. The up & down arrow keys can also be used.",10,10);
fill(#1abc9c);
text(speed,45,21);
y = y-0.9;
for (int i = 0; i < 80; i = i+5) {
y = y- speed;
line(0,y - i,width,y - i); line(i*Math.random(),i*Math.random() - i,width,y - i);
}
if (y < 0)
{
y = height + 80;
}
}
if (keyPressed){
if (key == "r" || key == "R") {
speed = 0;
}
}
</script>
<canvas id="canvas1"> </canvas>
CSS
body{
overflow:hidden;
background:#000;
}
JavaScript
new Processing(document.getElementById("canvas1"),
document.getElementById("processingcode").text);