Last active
August 4, 2016 19:40
-
-
Save jahpd/8414c7c4f042a9a30156e7173a71c17b 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
class Mbezier | |
constructor: -> | |
this['points'] = {x:{val:[]},y:{val:[]}} | |
this['colors'] = {r:{val:0},g:{val:0},b:{val:0},a:{val:0}} | |
n = 100; | |
o = []; | |
@setup = -> | |
@createCanvas 480, 360 | |
for i in [0..n-1] | |
o[i] = new Mbezier() | |
for color in o[i].colors | |
color.val = Math.random() * 255 | |
for point in o[i].points | |
point.val = Math.random() * @width for j in [0..2] | |
@stroke o[i].colors.r.val,o[i].colors.g.val, o[i].colors.b.val,o[i].colors.a.val | |
@noFill() | |
@bezier(o[i].points.x.val[0], | |
o[i].points.y.val[0], | |
o[i].points.x.val[1], | |
o[i].points.y.val[1], | |
o[i].points.x.val[2], | |
o[i].points.y.val[2], | |
o[i].points.x.val[3], | |
o[i].points.y.val[3]) | |
@draw = -> | |
@background 0 | |
for oo in o | |
@stroke oo.colors.r.val, oo.colors.g.val, oo.colors.b.val, oo.colors.a.val | |
@noFill() | |
@bezier(oo.points.x.val[0], | |
oo.points.y.val[0], | |
oo.points.x.val[1], | |
oo.points.y.val[1], | |
oo.points.x.val[2], | |
oo.points.y.val[2], | |
oo.points.x.val[3], | |
oo.points.y.val[3]) | |
c.val = Math.random() * 255 for c in oo.colors | |
for i in [0..2] | |
oo.points.x.val[i] = Math.random() * @width | |
oo.points.y.val[i] = Math.random() * @height |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment