| 41 | return cloud; |
| 42 | |
| 43 | function step() { |
| 44 | var start = +new Date, |
| 45 | d; |
| 46 | while (+new Date - start < timeInterval && ++i < n && timer) { |
| 47 | d = data[i]; |
| 48 | d.x = (size[0] * (Math.random() + .5)) >> 1; |
| 49 | d.y = (size[1] * (Math.random() + .5)) >> 1; |
| 50 | cloudSprite(d, data, i); |
| 51 | if (place(board, d, bounds)) { |
| 52 | tags.push(d); |
| 53 | event.word(d); |
| 54 | if (bounds) cloudBounds(bounds, d); |
| 55 | else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}]; |
| 56 | // Temporary hack |
| 57 | d.x -= size[0] >> 1; |
| 58 | d.y -= size[1] >> 1; |
| 59 | } |
| 60 | } |
| 61 | if (i >= n) { |
| 62 | cloud.stop(); |
| 63 | event.end(tags, bounds); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | cloud.stop = function() { |