Created
July 25, 2017 22:06
-
-
Save AllanJeremy/6c673fbd4229eadf798ed947d65983c5 to your computer and use it in GitHub Desktop.
Animatable fontawesome icons
This file contains hidden or 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
//need to figure way of fixing timeout in loop | |
function AnimateIcon(iconList,elementId,timeInSeconds) | |
{ | |
timeInSeconds*=1000;//Convert the timeIn seconds to milliseconds | |
var element = document.getElementById(elementId);//Get the element | |
var totalAnimationTime = 0; | |
var i = 0; | |
element.innerHTML= iconList[i]; | |
//Loop through all icons in the icon list | |
setTimeout(function(){ | |
totalAnimationTime += ((i+1)*timeInSeconds); | |
element.innerHTML = iconList[i]; | |
console.log(i); | |
i++; | |
},((i+1)*timeInSeconds)); | |
} | |
//Testing it out | |
var batteryCharge = ["","","","",""]; | |
AnimateIcon(batteryCharge,"battery",1); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment