-
-
Save shrutis22/c176eeba7bc62bf8a56f to your computer and use it in GitHub Desktop.
Animating Divs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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