[ Launch: Tributary inlet ] 5335199 by hemulin
-
-
Save hemulin/5335199 to your computer and use it in GitHub Desktop.
Tributary inlet
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":"Tributary inlet","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"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} |
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
function randomXToY(minVal,maxVal,floatVal) | |
{ | |
var randVal = minVal+(Math.random()*(maxVal-minVal)); | |
return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal); | |
} | |
tributary.init = function(g) { | |
var defs = g.append('defs'); | |
var gradient = defs.append('linearGradient') | |
.attr('id','g320') | |
.attr('gradientUnits','userSpaceOnUse') | |
.attr('x1','0%') | |
.attr('x2','0%') | |
.attr('y1','0%') | |
.attr('y2',141) | |
var stop1 = gradient.append('stop') | |
.attr('stop-color',"#68B4CF") | |
.attr('offset','0') | |
.attr('id','stop1'); | |
var stop2 = gradient.append('stop') | |
.attr('stop-color',"#4DE3AC") | |
.attr('offset','1') | |
.attr('id','stop2'); | |
var text = {"message":"Hello","amplitude":1.216,"segments":26.03,"change1":0,"functionName":"Sinus", "change2" : 16.3,"a":1,"b":1,"c":0}; | |
var boolFlag = false; | |
var circleBoundaries = d3.scale.linear().domain([0, 1489]).range([0.79, 20]); | |
var r = 576 / 2, | |
data = d3.range(361).map(function(i) { | |
var returnedValue = 1; | |
var val = circleBoundaries(returnedValue); | |
return val; | |
}); | |
var svg = g | |
.data([data]) | |
.append("g") | |
.attr("transform", "translate(" + r + "," + r + ")"); | |
var path = svg.append("path") | |
.attr("class", "area") | |
.attr('fill',"url(#g320)") | |
.attr("d", d3.svg.area.radial() | |
.innerRadius(100) | |
.outerRadius(function(d) { return r * d; }) | |
.angle(function(d, i) { return i / 180 * Math.PI; })); | |
g.pathy = path; | |
g.stop1 = stop1; | |
g.stop2 = stop2; | |
}; | |
var toogle = 1; | |
tributary.run = function(g,t) { | |
var delta = Math.floor(t * 100); | |
var rect = g.rect; | |
if(delta % 96 == 0 ){ | |
} | |
if(delta % 50 == 0 ){ | |
var r = 300; | |
var random = Math.sin(delta); | |
var radial = d3.svg.area.radial() | |
.innerRadius( function(d,i){ | |
return randomXToY(10,100); | |
}) | |
.outerRadius(function(d) { | |
return randomXToY(200,300); | |
}) | |
.angle(function(d, i) { | |
return i / 180 * Math.PI; | |
}); | |
g.stop2 | |
.transition() | |
.ease('elastic(20, 2)') | |
.duration(1000) | |
.attr('stop-color','#'+Math.floor(Math.random()*16777215).toString(16)) | |
g.stop1 | |
.transition() | |
.ease('elastic(20, 2)') | |
.duration(1000) | |
.attr('stop-color','#'+Math.floor(Math.random()*16777215).toString(16)) | |
g.pathy | |
.transition() | |
.ease('elastic(20, 2)') | |
.duration(1000) | |
.attr("d", radial) | |
.attr('fill',"url(#g320)") | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment