-
-
Save alblaine/3f8b6126dfbb5f681909 to your computer and use it in GitHub Desktop.
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
<!doctype html> | |
<html> | |
<head> | |
<script src="p5.js"></script> | |
<script> | |
var img; | |
function setup() { | |
createCanvas(600,600); | |
img = createImage(1372,1332,RGB); | |
var client = require('redis').createClient(); | |
client.on("error", function (err) { | |
console.log("error event - " + client.host + ":" + client.port + " - " + err); | |
}); | |
client.get("test:im:1", function (err, reply) { | |
img.loadPixels(); | |
data = JSON.parse(reply); | |
for (var idx = 0; idx < img.pixels.length; idx++) { | |
img.pixels[idx] = color(data[idx]/20.0,data[idx]/20.0,data[idx]/20.0); | |
} | |
console.log(img.pixels[0]); | |
img.updatePixels(); | |
}); | |
client.quit(function (err, res) { | |
console.log("Exiting from quit command."); | |
}); | |
} | |
function draw() { | |
image(img, 0, 0); | |
} | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment