[ Launch: Testing Controls ] 8607424 by ljbrown238
-
-
Save ljbrown238/8607424 to your computer and use it in GitHub Desktop.
Testing Controls
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":"Testing Controls","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":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"controls":{"test1":"option2","xcoord":254,"ycoord":132,"RectColor1":51,"RectColor2":38.25,"RectColor3":255},"thumbnail":"http://i.imgur.com/Xy4Yk86.gif"} |
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"); | |
var sel = tributary.control({name:"test1", options: ["option1", "option2"]}) | |
console.log("selected", sel); | |
var sliderValx = tributary.control({name:"xcoord", min: 100, max: 320}); | |
var sliderValy = tributary.control({name:"ycoord", min: 100, max: 420}); | |
var sliderVala = tributary.control({name:"RectColor1", min: 0, max: 255}); | |
var sliderValb = tributary.control({name:"RectColor2", min: 0, max: 255}); | |
var sliderValc = tributary.control({name:"RectColor3", min: 0, max: 255}); | |
// console.log("slider", sliderValx); | |
console.log(tributary.__controls__) | |
var rect = svg.append("rect") | |
.attr({ | |
x: sliderValx, | |
y: sliderValy, | |
width: 100, | |
height: 100 | |
}) | |
.style("fill",function() { return "#" + | |
pad(Math.round(sliderVala).toString(16),2) + | |
pad(Math.round(sliderValb).toString(16),2) + | |
pad(Math.round(sliderValc).toString(16),2); | |
}); | |
var foo = "#" + | |
pad(Math.round(sliderVala).toString(16),2) + | |
pad(Math.round(sliderValb).toString(16),2) + | |
pad(Math.round(sliderValc).toString(16),2); | |
console.log("foo:" + foo); | |
function pad(num, size) { | |
var s = num+""; | |
while (s.length < size) s = "0" + s; | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment