[ Launch: zzz ] 5526452 by gelicia
[ Launch: zzz ] 5521497 by gelicia
-
-
Save gelicia/5526452 to your computer and use it in GitHub Desktop.
zzz again
This file contains hidden or 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
{"description":"zzz again","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"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}},"fullscreen":false,"play":true,"loop":true,"restart":true,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01} |
This file contains hidden or 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
//thaaanks zeffii :D | |
var svg = d3.select('svg'); | |
var spinScale = d3.scale.linear().domain([0, 1]).range([0,360]); | |
var startPoint = {x: 487, y: 140}; | |
var size = 263; | |
var id = 0; | |
var pointAngle = 36; | |
var insideAngle = 108; //this will change | |
var halfsiesAngle= (180-pointAngle)/2; | |
var two_pi = 2 * Math.PI; | |
var num_points = 10; | |
var jump = two_pi / num_points; | |
var star = [] | |
var even, amp, ijump; | |
for (var i = 0; i < num_points; i+=1){ | |
even = i%2 === 0; | |
amp = even? size/2.6403: size | |
ijump = jump * i + 0.5*Math.PI; | |
star.push({x:Math.cos(ijump)*amp, y:Math.sin(ijump)*amp}) | |
} | |
tributary.init = function(g){ | |
var thisStar = g.selectAll("polygon #star") | |
.data([star]) | |
.enter().append("polygon") | |
.attr({ | |
points: function(d) { | |
return d.map(function(d) { return [d.x,d.y].join(","); }).join(" ");}, | |
// fill: 'black', | |
'stroke-width':1, | |
'stroke': 'black', | |
//'fill-opacity':'0.1', | |
id: 'star', | |
"transform": "translate(" + [startPoint.x, startPoint.y] + ") rotate(-59)" | |
}); | |
/* thisStar.attr({ | |
"transform": "rotate(98)" | |
});*/ | |
} | |
tributary.run = function(g, t){ | |
g.selectAll("#star") | |
.attr({ | |
"transform": "translate(" + [startPoint.x, startPoint.y] + ") rotate(" + spinScale(t) + ")" | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment