Created
August 5, 2012 00:45
-
-
Save roundrobin/3260875 to your computer and use it in GitHub Desktop.
just another inlet to tributary
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
d3.select('svg').style('background-color','black') | |
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 filter = defs.append('filter') | |
.attr('id','myFilterName') | |
var filter_elem2 = filter.append('feTurbulence') | |
.attr('result','result7') | |
.attr('id','fe2') | |
.attr('seed','27') | |
.attr('type','fractalNoise') | |
.attr('numOctaves','5') | |
.attr('baseFrequency','0.031'); | |
var filter_elem3 = filter.append('feComposite') | |
.attr('result','result6') | |
.attr('in','result7') | |
.attr('in2','SourceGraphic') | |
.attr('id','fe3') | |
.attr('operator','in') | |
g.filter_elem2 = filter_elem2; | |
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 = 473 / 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('transform','translate(100,30)') | |
.attr('fill',"url(#g320)") | |
.attr('filter','url(#myFilterName)') | |
.attr("d", d3.svg.area.radial() | |
.innerRadius(function(d,i) { | |
return 50; | |
}) | |
.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 % 38 == 0 ){ | |
var r = 82; | |
var random = Math.sin(delta); | |
var radial = d3.svg.area.radial() | |
.innerRadius( function(d,i){ | |
return randomXToY(100,200); | |
}) | |
.outerRadius(function(d) { | |
return randomXToY(30,251); | |
}) | |
.angle(function(d, i) { | |
return i*Math.PI+(Math.random()*2222) / Math.sin(d); | |
}); | |
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)) | |
var random = randomXToY(0.2,0.4) | |
g.filter_elem2 | |
.transition() | |
.ease('elastic(20, 2)') | |
.duration(1000) | |
.attr('numOctaves',Math.floor(4+(Math.random()*(5-4)))) | |
// .attr('baseFrequency',0.1+(Math.random()*(0.2-0.1))); | |
console.log(Math.floor(2+(Math.random()*(5-2)))) | |
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