[ Launch Inlet ]
Gist #4397064 [ Launch Inlet ]
Gist #4391938 [ Launch Inlet ]
Gist #4389758 [ Launch Inlet ]
Gist #4381188 [ Launch Inlet ]
Gist #4380030 [ Launch Inlet ]
Gist #3200444
-
-
Save zeffii/4397252 to your computer and use it in GitHub Desktop.
snowflake2b
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
{"description":"snowflake2b","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"snowfl.svg":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.3653840449411173,"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,"hidepanel":false} |
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 svg = d3.select("svg"); | |
function posTo(t, p){ | |
return ["", t, p.x, p.y].join(" ") | |
} | |
function posTo2(t, p){ | |
return ["", t, p.x1, p.y1, p.x2, p.y2].join(" ") | |
} | |
function random_between(i, j){ | |
return i + Math.floor(Math.random() * (j - i + 1)) | |
} | |
function draw_flake(pos){ | |
var flake_group = svg.append("g").classed("flake", true) | |
.attr("transform", "translate("+[pos.x,pos.y] +") scale(.3)") | |
.style({"fill": "none", | |
"stroke": "3D7DAB", | |
"stroke-opacity": 1.0, | |
"stroke-width": 32 + "px"}) | |
// var c1 = 0, c2 = 163, c3 = 55, c4 = 127, c5 = 97; | |
var c1 = 0, | |
c2 = random_between(47,163), | |
c3 = random_between(25,78), | |
c4 = random_between(20,127), | |
c5 = random_between(22,121); | |
var nupath = posTo('M', {x:c1, y:c2}) | |
+ posTo('L', {x:c1, y:-c2}) | |
+ posTo('M', {x:c3, y:-c4}) | |
+ posTo2('L', {x1:c1, y1:-c5, x2:-c3, y2:-c4}) | |
+ posTo('M', {x:c3, y:c4}) | |
+ posTo2('L', {x1:c1, y1:c5, x2:-c3, y2:c4}) | |
flake_group.append("path") | |
.attr({"id": "arm", | |
"d": nupath }) | |
flake_group.append("use").attr({ | |
"xlink:href": "#arm", | |
"transform": "rotate(-60, 0, 0)" | |
}) | |
flake_group.append("use").attr({ | |
"xlink:href": "#arm", | |
"transform": "rotate(-120, 0, 0)" | |
}) | |
} | |
draw_flake({x:66, y:89}) | |
draw_flake({x:179, y:89}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment