Skip to content Skip to sidebar Skip to footer

Update, Exit, Update, Enter Patterns With Transition

Essentially, according to this bl.ocks, I am trying to have all the blocks go to 0 before starting a new sequence. I think what I require is the following sequence: Update to 0 Ex

Solution 1:

You cannot just call update twice, like this:

update(Math.floor(0);
update(Math.floor(Math.random() * 100 * 100));

You have to set up another setTimeout:

(function interval() {
    update(Math.floor(Math.random() * 100 * 100));
    setTimeout(function() {
            update(0)
        },
        updateDelay * 100 * 100 + updateDuration + 1000);
    setTimeout(interval, 2 * (updateDelay * 100 * 100 + updateDuration + 1000));
})();

Here I lazily just multiplied the delay of the setTimeout which calls interval again by 2, you may want to change those delays accordingly.

Here is the updated bl.ocks: https://bl.ocks.org/GerardoFurtado/9b3fc45d5c1d3af7e53daef7df28ac11/e25d1478fc2899a402e1dbfaad2090df6b012804

Post a Comment for "Update, Exit, Update, Enter Patterns With Transition"