I am using Raphael JS library and here is my code:
var rectangle = paper.rect(0, 0, 5, 5);
rectangle.attr({opacity: 0});
// I need here a 5 seconds delay, before starting an animation
rectangle.animate({opacity: 1}, 2000);
I have tried rectangle.attr({opacity: 0}).delay(5000); and also this: rectangle.attr({opacity: 0}, 5000); , but none of these seems to work at all.
What is the simplest way to wait some time before excuting other code. I would not like to use nested functions or for loops at all, if possible.
Use Raphael.animation and Animation.delay.