MCPcopy
hub / github.com/jasondavies/d3-cloud / step

Function step

index.js:62–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 return cloud;
61
62 function step() {
63 var start = Date.now();
64 while (Date.now() - start < timeInterval && ++i < n && timer) {
65 var d = data[i];
66 d.x = (size[0] * (random() + .5)) >> 1;
67 d.y = (size[1] * (random() + .5)) >> 1;
68 cloudSprite(contextAndRatio, d, data, i);
69 if (d.hasText && place(board, d, bounds)) {
70 tags.push(d);
71 event.call("word", cloud, d);
72 if (bounds) cloudBounds(bounds, d);
73 else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}];
74 // Temporary hack
75 d.x -= size[0] >> 1;
76 d.y -= size[1] >> 1;
77 }
78 }
79 if (i >= n) {
80 cloud.stop();
81 event.call("end", cloud, tags, bounds);
82 }
83 }
84 }
85
86 cloud.stop = function() {

Callers 1

index.jsFile · 0.85

Calls 3

cloudSpriteFunction · 0.85
placeFunction · 0.85
cloudBoundsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…