View this code at http://livecoding.io/4239707
-
-
Save gcusso/4239707 to your computer and use it in GitHub Desktop.
created by http://livecoding.io
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
{ | |
"libraries": [ | |
"Processing" | |
], | |
"mode": "javascript", | |
"layout": "fullscreen mode (vertical)" | |
} |
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
pre { | |
position: absolute; | |
color: #FFF; | |
background: #000; | |
} | |
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
<canvas></canvas> | |
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
var numberOfIterations = 10000; | |
// walker prototype | |
var particle = { | |
x: null, | |
y: null, | |
init: function(startX, startY) | |
{ | |
this.x = startX; | |
this.y = startY; | |
}, | |
display: function(p) | |
{ | |
p.stroke(0); | |
p.point(this.x, this.y); | |
}, | |
step: function(p) | |
{ | |
this.x += rand() * 2 - 1; | |
this.y += rand() * 2 - 1; | |
} | |
}; | |
function Walker(x, y) | |
{ | |
function F() {}; | |
F.prototype = particle; | |
var f = new F(); | |
f.init(x, y); | |
return f; | |
} | |
var x = 520; | |
var y = 500; | |
var a = 0; | |
var tam = 21.5; | |
// processing sketch | |
function sketch(p) | |
{ | |
var walker; | |
p.setup = function() | |
{ | |
p.size($(window).width()*0.99, $(window).height()*0.99); | |
p.background(245); | |
}; | |
p.draw = function() | |
{ | |
//p.background(245); | |
p.fill(30); | |
p.strokeWeight(0.9); | |
p.stroke(120,0,120); | |
x = 300 + p.cos(a) * 100; | |
y = 300 + p.tan(a) * 100; | |
a += 0.011; | |
p.ellipse(x,y,tam,tam); | |
} | |
} | |
var canvas = $('canvas').get(0); | |
var processingInstance = new Processing(canvas, sketch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment