Last active
February 6, 2019 02:20
-
-
Save newbdez33/815f7537412d6ae3e82a21496df72b07 to your computer and use it in GitHub Desktop.
[p5js] pixels project #monster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://compform.net/js_lab/js_lab.html?/pixels/sketches/basic_pixels_3.js | |
//https://p5js.org/examples/advanced-data-load-saved-json.html | |
// require https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.14/p5.js | |
function setup() { | |
createCanvas(500, 500); | |
} | |
function draw() { | |
background(0); | |
img = createImage(100, 100); | |
img.loadPixels(); | |
for (var i = 0; i < 500; i++) { | |
var c = color(255, 0, 0); | |
img.set(random(100), random(100), c); | |
} | |
img.updatePixels(); | |
noSmooth(); | |
image(img, 0, 0, width, height); | |
noLoop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment