I want to add a flash-animation of an object so it "blinks" when something happens. How can I do this in Javascript?
I want the "block" object to blink.
function createBlocks(source) {
$.ajax({
url : "blockList",
type : "GET",
dataType : "json",
data : {
source : source
},
success : function(response) {
var arrayBlock = [];
var source1 = parseInt(response[0].source);
var container = document.getElementById("block"+source1);
if(container.childNodes[1])container.removeChild(container.childNodes[1]);
for (var i = 0; i < response.length; i++) {
var block = {};
source1 = parseInt(response[i].source);
block.level = parseInt(response[i].level, 10);
block.width = parseFloat(response[i].width);
block.position = parseInt(response[i].position, 10);
block.name = response[i].superCategory.toString();
block.colour = response[i].statusColor.toString(); // colour
arrayBlock.push(block);
}
$('#block'+source1).Block({
'height' : 300,
'base' : 1200,
'slices' : 4,
'slice_separation' : 0.1,
'colours' : [ 'red', 'yellow', 'green', 'blue' ],
'text' : [ '1', '2', '3', '4' ],
'source' : source1,
'arrayBlock' : arrayBlock
});
setTimeout("createBlocks("+source1+")",3000);
},
Error : function() {
setTimeout("createBlocks("+source1+")",3000);
alert("Error: loading the Blocks");
}
});
}
A further explanation would be that I want this blinking animation to appear after a certain time that I have received source. How can I do this?