I'm trying to force one animation to start after another ends, and according to documentation, I should include a callback function, which should be called at the end of animation.
However, both animations are performed simultaneously... what am I doing wrong?
$(document).ready(function () {
function drawBonuses() {
bonus = [3, 9, 10, 17];
$.each(bonus,function(i,v) {
gameboard.circle( v*20+20, 20, 0).animate( { fill: "#f00", r: 5 } , 100);
});
};
gameboard = Raphael("gameboard", 440, 440);
gameboard.clear();
gameboard.rect(200, 200, 0, 0, 5).animate({fill: "#fff", height: 400, width: 400, x:20, y:20, stroke: "#000", "stroke-width": 20}, 2000, drawBonuses());
});
The dots should start animating when the board is completely animated...