Tweening with robert penners quadratic equations

E

eddie

I am trying to come up with a simple tweening prototype. I have two
issues. The first is, why can't i have a div, with
onclick="this.tweento();" - why does that produce an error
"this.tweento(); is not a function". Second, how can I make the
function below, actually work ...

regards,

-eddie

/* Begin code */

// t = current time
// b = start value
// c = change in value
// d = duration

// Robert Penners Easing functions
easeInQuad = function(t,b,c,d) {
t/=d;
return c*t*t+b;
}

HTMLobj.prototype.tweenTo = function(method, start, end, time) {
if(!this._tweenRunning) {
this._tweenTime=0;
var s='['+start.toString()+']';
var e='['+end.toString()+']';
this._timer=setInterval(this._obj+'.tweenTo('+method+','+s+','+e+','+time+')',33);
this._tweenRunning=true;
}
if(++this._tweenTime>time){
this.cancelTween();
}else{var w=method(this._tweenTime,start[0],end[0]-start[0],time);
var h=method(this._tweenTime,start[1],end[1]-start[1],time);
this.sizeTo(w,h);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top