User:Ember314/frog.js

$('body').prepend(' '); $('body').prepend(" "); $('body').prepend(' #funCanvas{ position: absolute; left: 0; right: 0;top: 0;bottom: 0;height: 200%;width: 100%; z-index: 1000000;pointer-events: none; overflow: auto;} '); var sketchHeight, sketchWidth; function setup { sketchWidth = document.getElementById("funCanvas").offsetWidth; sketchHeight = document.getElementById("funCanvas").offsetHeight; var canvas = createCanvas(sketchWidth, sketchHeight); canvas.parent('funCanvas'); //background(245); frameRate(3000); }

function draw { //background('rgba(245,245,245,0.01)'); if (mouseY !=null) { push; scale(cos(frameCount * (mouseX * 0.005))); strokeWeight(Math.floor(Math.random * (5 - 0 + 0.1) + 0)); if (mouseX > 500 && mouseX < 600) { stroke(0, 225, 0); beginShape(LINES); vertex(0, 0); vertex(mouseX, mouseY); endShape; fill(0, Math.floor(Math.random * (225 - 0 + 1) + 0), 0); rect(mouseX, mouseY, Math.floor(Math.random * (50 - 10 + 1) + 10), Math.floor(Math.random * (50 - 10 + 1) + 10)); } else if (mouseX > 800 && mouseX < 900) { stroke(0, 0, 225); beginShape(LINES); vertex(0, 0); vertex(mouseX, mouseY); endShape; fill(0, 0, Math.floor(Math.random * (225 - 0 + 1) + 0)); polygon(mouseX, mouseY, Math.floor(Math.random * (30 - 5 + 1) + 5), Math.floor(Math.random * (10 - 3 + 1) + 3)); } else { stroke(225, 0, 0); beginShape(LINES); vertex(0, 0); vertex(mouseX, mouseY); endShape; fill(Math.floor(Math.random * (225 - 0 + 1) + 0), 0, 0); circle(mouseX, mouseY, Math.floor(Math.random * (50 - 10 + 1) + 10)); }       pop; } }

function polygon(x, y, radius, npoints) { var angle = TWO_PI / npoints; beginShape; for (var a = 0; a < TWO_PI; a += angle) { var sx = x + cos(a) * radius; var sy = y + sin(a) * radius; vertex(sx, sy); }   endShape(CLOSE); }