Skip to content

Instantly share code, notes, and snippets.

@jahpd
Last active July 6, 2017 15:45
Show Gist options
  • Save jahpd/79d2c5a6f3e1bd77d3afc0e7111c088a to your computer and use it in GitHub Desktop.
Save jahpd/79d2c5a6f3e1bd77d3afc0e7111c088a to your computer and use it in GitHub Desktop.
n = 19
a = {x:[],y:[]} for i in [0..n-1]
update = (a, fn) ->
for _n in [0..a.length-1]
for key,val of a[_n]
fn(_n,key,val)
@text a[_n], 10, (_n+1)*(n/@width)
callback = (n, k, v) ->
v = @random (if k is 'x' then @width else (if k is 'y' then @height))
@setup = ->
@createCanvas 480, 360
# Log is some preadded variable
@textFont log
@textSize 20
update a, callback
@draw = ->
@background 0
@noFill()
for i in [0..a.length-1]
@stroke @random 255, @random 255, @random 255
@bezier(a[i].x[0], a[i].y[0], a[i].x[1], a[i].y[1],a[i].x[2],a[i].y[2],a[i].x[3],a[i].y[3])
update a, callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment