-
-
Save hiddendragonXVII/1116328 to your computer and use it in GitHub Desktop.
A tiny shim for Processing/Coffeescript prototyping
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> | |
<title>CoffeeScript/Processing</title> | |
<script src="https://raw.github.com/jeresig/processing-js/master/processing.js"></script> | |
<script src="https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js"></script> | |
<script src="https://raw.github.com/gist/1114064/professing.js"></script> | |
<script type="text/coffeescript"> | |
sketch -> | |
@setup = => | |
@size 300, 300 | |
@background 255 | |
@noFill() | |
@frameRate 10 | |
@draw = => | |
x = @random 0, @width | |
y = @random 0, @height | |
size = @random 10, 100 | |
@ellipse x, y, size, size | |
@background 255 if @frameCount % 100 is 0 | |
</script> |
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
window.sketch = function (func) { | |
var canvas = document.createElement('canvas'); | |
document.body.appendChild(canvas); | |
new Processing(canvas, function (processing) { func.call(processing); }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment