By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,592 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

Tweening with robert penners quadratic equations

P: n/a
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('+meth od+','+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);
}
}

Nov 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
VK
eddie wrote:
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".
see
<http://groups.google.com/group/comp.lang.javascript/msg/2a533313710fdb1b>

Nov 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.