[ Launch: Tributary inlet ] 6096180 by enjalot
[ Launch: Tributary inlet ] 6077096 by enjalot
See Previous Inlet [ Gist ]
-
-
Save enjalot/6096180 to your computer and use it in GitHub Desktop.
Tributary inlet
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
{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":304,"height":402,"hide":true},"endpoint":"","description":"Tributary inlet","display":"canvas","public":true,"require":[],"fileconfigs":{"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":true,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/gXXBlUk.gif"} |
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
// View live at http://enjalot.com/cypress/3126863 | |
var n = 3200; // number of dots | |
var j = -2.07822; // time spinning | |
var k = 1.6; // spinning constant | |
var opacity = 0.8; // dpt opacity | |
var scale = 4; | |
var erasing = .1; | |
trib.munch = 5; | |
trib_options.munch = {min:-0.45, max: 0.45} | |
tributary.t = 10; | |
var w = tributary.sw, | |
h = tributary.sh; | |
tributary.init = function(ctx) { | |
//d3.select('#display').style('background', "#090909"); | |
ctx.globalCompositeOperation = 'source-over'; | |
}; | |
tributary.run = function(ctx,t) { | |
ctx.fillStyle = "rgba(9,9,9," + erasing + ")"; | |
ctx.fillRect(0,0,w,h); | |
ctx.fillText(t,5,5); | |
GOLDEN_ANGLE = Math.PI * (j*t/400 - Math.sqrt(k*(t+1)/500)); | |
var points = d3.range(1, n).map(place); | |
points.forEach(circle); | |
function circle(p,i) { | |
ctx.fillStyle = 'hsla(0,00%,' + 100 +'%,' + opacity + ')' | |
ctx.beginPath(); | |
ctx.arc(p[0],p[1],1,0,2*Math.PI); | |
ctx.fill(); | |
} | |
function place(n) { | |
var r = Math.sqrt(n), | |
a = GOLDEN_ANGLE / Math.cos(t * n/30)*trib.munch; | |
return [scale * r * Math.cos(a)+w/2, scale * r * Math.sin(a)+h/2 - 30]; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment