Eh, I think I'm going to abandon this approach, I finally got it to work (kind of), but my math formula isn't producing the desired effect-http://codepen.io/devindavid/pen/YwjNeV
I just ended up timing everything manually, which ended up being good because I had better control over things- http://codepen.io/devindavid/pen/rxKJLK
But, Here's what I did to dynamically update the repeating tween duration using an onRepeat callback and the .duration() method. Everything in the getDuration() function can be replaced with any variables and functions to calculate the value.
function myTimedFunction() {
var timerDuration = 10000;
var d = new Date();
var t = d.getTime();
var tween = new TweenMax.to(".element", 3, {
x:"1200px",
ease:Power0.easeInOut,
onRepeat:getDuration,
repeat:-1
});
function getDuration() {
var elapsedTime = function(){
var e = Math.floor(Date.now()) - t;
return e;
};
var remainingTime = function(){
var r = timerDuration - elapsedTime();
return r;
};
var durationSpeed = function() {
var j = remainingTime() / timerDuration;
var k = Math.pow(j, 3) * (elapsedTime() / 2);
var l = ((k + 300)/1000);
return l;
};
tween.duration(durationSpeed());
};
};
window.onload = myTimedFunction();
setInterval(function() {
myTimedFunction();
}, 10000);