Skip to content

Instantly share code, notes, and snippets.

@shrutis22
Created January 15, 2016 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrutis22/c176eeba7bc62bf8a56f to your computer and use it in GitHub Desktop.
Save shrutis22/c176eeba7bc62bf8a56f to your computer and use it in GitHub Desktop.
Animating Divs
function moveBlocks() {
randBlocks();
var topOpp1 = parseInt($(".opponent-1").css("top"));
var topOpp2 = parseInt($(".opponent-2").css("top"));
var topOpp3 = parseInt($(".opponent-3").css("top"));
if (topOpp1 >= 400 || topOpp2 >= 400 || topOpp3 >= 400) {
$(".opponent-1").css("top", 0);
$(".opponent-2").css("top", 0);
$(".opponent-3").css("top", 0);
points();
}
var prop = {
top: "+=400"
};
var time = 1500;
var easing = "linear";
$(".opponent-3").animate(prop, time, easing);
$(".opponent-1").animate(prop, time, easing);
$(".opponent-2").animate(prop, time, easing, moveBlocks);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment