Skip to content

Instantly share code, notes, and snippets.

@Spaxe
Created March 13, 2015 00:11
Show Gist options
  • Save Spaxe/484081c34be058376ad2 to your computer and use it in GitHub Desktop.
Save Spaxe/484081c34be058376ad2 to your computer and use it in GitHub Desktop.
p5js with browserfy
// Thanks to @brysonian
// https://github.com/processing/p5.js/issues/522#issuecomment-78510817
var p5 = require("p5");
var myp5 = new p5(function( sketch ) {
sketch.setup = function() {
var cnv = sketch.createCanvas(500, 500);
sketch.colorMode(sketch.HSB, 360, 100, 100);
sketch.noStroke();
};
sketch.draw = function() {
var h = sketch.frameCount % 360;
sketch.fill(h, 100, 100);
sketch.rect(0, 0, sketch.width, sketch.height);
};
}, 'sketchdiv');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment