Skip to content

Instantly share code, notes, and snippets.

@gelicia
Created April 30, 2013 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gelicia/5485765 to your computer and use it in GitHub Desktop.
Save gelicia/5485765 to your computer and use it in GitHub Desktop.
i wanna play too
{"description":"i wanna play too","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}
//no way will I get this right.. http://ffffound.com/image/213154fa99b5933e766d9253a741d39b1ac6542d
tributary.loop_type = "period";
tributary.autoinit = true;
var speed = 6.23;
var leftC = {x:150, y: 100, r : 75}
var rightC = {x:226, y: 168, r : 75}
var midPoint = {
x: (leftC.x + rightC.x) / 2,
y: (leftC.y + rightC.y) / 2
}
var connectLine = {x1: leftC.x + leftC.r,
y1: leftC.y,
x2: rightC.x - rightC.r,
y2: rightC.y}
var leftRightRotDist = Math.sqrt(Math.pow(((leftC.x + leftC.r)-), 2) + Math.pow( , 2));
tributary.init = function(g){
g.append('circle')
.attr({
cx: leftC.x,
cy: leftC.y,
r: 3,
id: 'leftMid'
});
g.append('circle')
.attr({
cx: leftC.x + leftC.r,
cy: leftC.y,
r: 3,
id: 'leftRot'
});
g.append('line')
.attr({
x1: leftC.x,
y1: leftC.y,
x2: leftC.x + leftC.r,
y2: leftC.y,
stroke: 'black',
'stroke-width': 1,
'id': 'leftLine'
});
g.append('circle')
.attr({
cx: rightC.x,
cy: rightC.y,
r: 3,
id: 'rightMid'
});
g.append('circle')
.attr({
cx: rightC.x - rightC.r,
cy: rightC.y,
r: 3,
id: 'rightRot'
});
g.append('line')
.attr({
x1: rightC.x,
y1: rightC.y,
x2: rightC.x - rightC.r,
y2: rightC.y,
stroke: 'black',
'stroke-width': 1,
'id': 'leftLine'
});
g.append('circle')
.attr({
cx: midPoint.x,
cy: midPoint.y,
r: 3,
id: 'midPoint',
fill: 'red'
});
g.append('line')
.attr({
x1: connectLine.x1,
y1: connectLine.y1,
x2: connectLine.x2,
y2: connectLine.y2,
stroke: 'black',
'stroke-width': 1,
id: 'midLine'
})
}
tributary.run = function(g, t){
//this is not how it goes but yolo
//i need to go to bed so mark olson doesn't yell at me for spamming his github feed any more :(
g.select('#leftRot')
.attr({
cx: leftC.r * Math.cos(t * speed) + leftC.x,
cy: leftC.r * Math.sin(t * speed) + leftC.y
});
g.select('#leftLine')
.attr({
x2: leftC.r * Math.cos(t * speed) + leftC.x,
y2: leftC.r * Math.sin(t * speed) + leftC.y
});
g.select('#midLine')
.attr({
x1 : leftC.r * Math.cos(t * speed) + leftC.x,
y1 : leftC.r * Math.sin(t * speed) + leftC.y
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment