Thanks Ashley ! I think the JS noob gets it! This is really cool, being able to call a custom JS function inside a layout.
This works by calling skillStart() on start of layout and skillStop() on end of layout (to prevent it from creating multiple intervals) and basically, (along with some CSS) pulses a progress bar between two values.
function anipgbar() {
var p = document.getElementsByClassName("animated");
var orig = parseInt(p[0].getAttribute('data-orig'));
var cval = parseInt(p[0].getAttribute('value'));
if (cval > orig) {
p[0].setAttribute('value', orig);
} else
{
p[0].setAttribute('value', orig + 1);
}
};
var drawInterval;
function skillStop() {
clearInterval(drawInterval);
};
function skillStart() {
drawInterval = setInterval(anipgbar, 2000);
};