Skip to content

Instantly share code, notes, and snippets.

@hiddendragonXVII
Forked from j4mie/example.html
Created July 31, 2011 02:59
Show Gist options
  • Save hiddendragonXVII/1116328 to your computer and use it in GitHub Desktop.
Save hiddendragonXVII/1116328 to your computer and use it in GitHub Desktop.
A tiny shim for Processing/Coffeescript prototyping
<!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>
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