Let our functions escape the bondage of integers and vary freely with time.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@364 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -36,7 +36,7 @@ public class HermiteFunc extends InterpFunc
|
||||
}
|
||||
|
||||
// from InterpFunc
|
||||
override public function getValue (t :Number) :int
|
||||
override public function getValue (t :Number) :Number
|
||||
{
|
||||
if (t >= 1) {
|
||||
return _p1;
|
||||
@@ -46,10 +46,10 @@ public class HermiteFunc extends InterpFunc
|
||||
var tt :Number = t*t;
|
||||
var ttt :Number = tt * t;
|
||||
|
||||
return int(_p0 * (2*ttt - 3*tt + 1) +
|
||||
_m0 * (ttt - 2*tt + t) +
|
||||
_p1 * (-2*ttt + 3*tt) +
|
||||
_m1 * (ttt - tt));
|
||||
return _p0 * (2*ttt - 3*tt + 1) +
|
||||
_m0 * (ttt - 2*tt + t) +
|
||||
_p1 * (-2*ttt + 3*tt) +
|
||||
_m1 * (ttt - tt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ package com.threerings.flash.path {
|
||||
*/
|
||||
public /*abstract*/ class InterpFunc
|
||||
{
|
||||
public /*abstract*/ function getValue (complete :Number) :int
|
||||
public /*abstract*/ function getValue (complete :Number) :Number
|
||||
{
|
||||
throw new Error("abstract");
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@ public class LinearFunc extends InterpFunc
|
||||
}
|
||||
|
||||
// from InterpFunc
|
||||
override public function getValue (complete :Number) :int
|
||||
override public function getValue (complete :Number) :Number
|
||||
{
|
||||
if (complete >= 1) {
|
||||
return _end;
|
||||
} else if (complete < 0) { // cope with a funny startOffset
|
||||
return _start;
|
||||
} else {
|
||||
return int((_end - _start) * complete) + _start;
|
||||
return ((_end - _start) * complete) + _start;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user