Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active August 29, 2015 14:22
Show Gist options
  • Save zeffii/63f6e83388a2a2f80061 to your computer and use it in GitHub Desktop.
Save zeffii/63f6e83388a2a2f80061 to your computer and use it in GitHub Desktop.
braid coil 001
{"description":"braid coil 001","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data2.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"util.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"tbush.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"rbush.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"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,"ajax-caching":true,"thumbnail":"http://i.imgur.com/suqr8WF.png"}
// WOW. AM TOO RSTY!!!!!
d3.select("body").style("background-color", d3.rgb(25,25,25))
var svg = d3.select("svg");
var defs = svg.append("defs");
var group1 = svg.append("g").classed("group1", true);
group1.attr("transform", "translate(" + [287, 365] + ")")
.style({'fill': "none", stroke: "#aeaeae"})
var TWO_PI = Math.PI * 2
var EPS = 0.00001;
// get_points(angle, cp, {}, amp)
function get_point(angle, amp){
var pos = {};
pos.x = Math.cos(angle) * amp
pos.y = Math.sin(angle) * amp
return pos
}
function make_points(count, mod_func){
var data = [];
var angle, p, rate, reamp;
var amp = 307;
var minor_amp = 244;
for (var i=0; i<count; i+=1){
rate = i / count;
angle = rate * TWO_PI
reamp = mod_func(rate, amp);
p = get_point(angle, minor_amp + reamp); // -
data.push([p.x, p.y])
}
return data
}
function modulator(rate, amp){
var pos_tamp = (Math.log((Math.sin(rate/2*TWO_PI))+EPS)) /8;
var num_waves = Math.round(-19);
var unit = Math.sin(rate * TWO_PI * num_waves) * amp * pos_tamp;
return unit / 8;
}
var data = make_points(646, modulator);
var blocks = group1.selectAll("g").data(data)
.enter()
.append("g")
.attr("transform", function(d, i) { return "translate(" + d + ")"});
var circle = blocks.append("circle")
.attr({ "r": 4})
.style({fill: "#aaaaaa"})
tributary.run = function(unused, t){
}
/* EOF */
.cm-s-lesser-dark.CodeMirror { background: #1e2426; color: #696969; }
.cm-s-lesser-dark div.CodeMirror-selected {background: #064968 !important;} /* 33322B*/
.cm-s-lesser-dark span.cm-variable { color:#22EFFF; }
.cm-s-lesser-dark span.cm-variable-2 { color: #FFCCB4; }
.cm-s-lesser-dark span.cm-variable-3 { color: white; }
.cm-s-lesser-dark span.cm-string { color: Chartreuse; }
.cm-s-lesser-dark span.cm-string-2 {color: Chartreuse;}
.cm-s-lesser-dark span.cm-def {color: #FFCCB4; opacity: 1.0}
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
.cm-s-lesser-dark pre { color:#FFF; }
.cm-s-lesser-dark span.cm-comment { color: #AFB4B4;}
.cm-s-lesser-dark span.cm-property {color: #FDA676;}
.cm-s-lesser-dark span.cm-number { color: #FF92EE;}
.cm-s-lesser-dark span.cm-keyword { color: #FFFF18; }
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-lesser-dark .CodeMirror-gutters {background: #505050;}
.cm-s-lesser-dark .CodeMirror-linenumber {color: #D3D3D3;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment