Skip to content

Instantly share code, notes, and snippets.

@wxs
Created June 23, 2017 23:18
Show Gist options
  • Save wxs/d95a1239fad5cafd8eacf8417d2a137f to your computer and use it in GitHub Desktop.
Save wxs/d95a1239fad5cafd8eacf8417d2a137f to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<script src="p5.js"></script>
<script>
function setup() {
createCanvas(800, 600);
background(255);
}
function draw() {
colorMode(HSB, 360, 255, 255)
fill(frameCount % 360, 255, 255, 0.5);
stroke(0);
for (let col = 0; col < 800; col += 20) {
for (let row = 0; row < 600; row += 20) {
beginShape();
for (let i = 0; i < 7; i++) {
let angle = i/6*TWO_PI;
vertex(col + 8 * cos(angle) , row + 8 * sin(angle));
}
endShape();
}
}
fill(255);
rect(0,height-20, 100, height);
fill(0);
text("fps: " + frameRate(), 10, height-5);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment