To pretty it up, remove the circle fill in collatz.css and modify the circle append (line 83) in collatz.js as follows:
nodeEnter.append("circle")
.attr("fill", function(d) {
var cc;
var i = parseInt(d.data);
if ((i && (i & (i - 1)) === 0) && (i <= 16)) {
cc = "#0000ff";
}
else if ((i % 3) === 0) {
cc = "#c8c8c8";
}
else if ((i % 6) === 1) {
cc = "#ffff00";
}
else if (((i % 2) === 1) || (((i % 3) === 2) && (((i / 2) % 2) === 0))) {
cc = "#ffa500";
}
else {
cc = "#000000";
}
return cc;
})
.attr("r", 5);
I was only interested in the initial node for those in orange and yellow.
No comments:
Post a Comment