Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
function setup() { | function setup() { | ||
var c = createCanvas(windowWidth, windowHeight); | var c = createCanvas(windowWidth, windowHeight); | ||
− | + | c.parent("variable-geometry"); | |
frameRate(15); | frameRate(15); | ||
} | } | ||
function draw() { | function draw() { | ||
− | |||
background(random(230, 240)); | background(random(230, 240)); | ||
− | + | ||
− | noStroke() | + | noStroke(); |
fill(0); | fill(0); | ||
rect(97, 169, 79, 12); | rect(97, 169, 79, 12); | ||
− | |||
rect(365, 184, 20, 15); | rect(365, 184, 20, 15); | ||
fill(20, 20, 120); | fill(20, 20, 120); | ||
Line 32: | Line 30: | ||
endShape(CLOSE); | endShape(CLOSE); | ||
− | |||
noFill(); | noFill(); | ||
stroke(130); | stroke(130); | ||
Line 38: | Line 35: | ||
ellipse(255, 350, static_size, static_size); | ellipse(255, 350, static_size, static_size); | ||
− | |||
stroke(180); | stroke(180); | ||
ellipse(mouseX, mouseY, moving_size, moving_size); | ellipse(mouseX, mouseY, moving_size, moving_size); | ||
Line 44: | Line 40: | ||
if (mouseIsPressed) { | if (mouseIsPressed) { | ||
static_size = floor(random(5, 20)); | static_size = floor(random(5, 20)); | ||
− | + | } | |
} | } |
Revision as of 12:28, 29 September 2021
/* Any JavaScript here will be loaded for all users on every page load. */ mw.loader.load('https://github.com/processing/p5.js/releases/download/v1.4.0/p5.js'); /*Inspired by David Reinfurt's work - Multi*/ let moving_size = 50; let static_size = 20; function setup() { var c = createCanvas(windowWidth, windowHeight); c.parent("variable-geometry"); frameRate(15); } function draw() { background(random(230, 240)); noStroke(); fill(0); rect(97, 169, 79, 12); rect(365, 184, 20, 15); fill(20, 20, 120); beginShape(); vertex(365, 199); vertex(385, 199); vertex(372, 216); vertex(358, 216); endShape(CLOSE); noFill(); stroke(130); strokeWeight(2); ellipse(255, 350, static_size, static_size); stroke(180); ellipse(mouseX, mouseY, moving_size, moving_size); if (mouseIsPressed) { static_size = floor(random(5, 20)); } }