d3.js - Running d3.timer on intervals -
this mutual timing function in d3 examples:
d3.timer(function() { var angle = (date.now() - start) * speed, transform = function(d) { homecoming "rotate(" + angle / d.radius + ")";}; lightsweep.select(".lightsweep").attr("transform", transform); });
the "lightsweep" specific me. d.radius pulled info object bound "lightsweep" object , used rotate svg group. code works me, run intermittently; say, run 1 second, wait 10 seconds before running again. how can that?
note: not want utilize setinterval or settimeout. d3 timer has amazing attributes , improve functions. d3.timer requires return true
cancel it. imagine might callback function not able think of it.
thanks help.
yes d3.timer - uses requestanimationframe internally on browsers back upwards - has nice properties pausing when window/tab not in foreground. in tutorial code, mike bostock (d3 author) uses setinterval cover utilize case, unfortunately might best option.
d3.js
No comments:
Post a Comment