[Actor] Implement compound(length,tweens) in _fallback/02 Actor.lua. also I guess I changed the luadocs?

This commit is contained in:
AJ Kelly
2011-06-24 14:19:19 -05:00
parent fc647bc63c
commit acda84e4e4
3 changed files with 2171 additions and 2132 deletions
+1
View File
@@ -10,6 +10,7 @@ StepMania 5.0 Preview 2 | 201106??
2011/06/24
----------
* [Actor] Implement compound(length,tweens) in _fallback/02 Actor.lua. [AJ]
* [UnlockManager] Add a new unlock reward: StepsType. This is similar to
unlocking Steps, but it is targeted for one step in one stepstype rather
than one step in all stepstypes. This needs testing. [Wolfman2000]
+2132 -2132
View File
File diff suppressed because it is too large Load Diff
+38
View File
@@ -83,6 +83,44 @@ local DropBezier =
function Actor:drop(t)
self:tween( t, "TweenType_Bezier", DropBezier );
end
-- compound tweens "combine multiple interpolators to allow generating more
-- complex tweens." length is how long to span the animation for, while
-- ... is either a string (e.g. "linear,0.25,accelerate,0.75") or a table
-- with the tween information.
function Actor:compound(length,...)
local tweens = ...
if type(tweens) == "string" then
local parsed = split(";",tweens)
tweens = {} -- convert to table
for i,s in pairs(parsed) do
local res = split(",",s)
tweens[i] = {
Type = res[1],
Percent = res[2],
Bezier = res[3] or nil
}
end
end
for i,t in pairs(tweens) do
if t.Type == "linear" then self:linear(t.Percent*length)
elseif t.Type == "accelerate" then self:accelerate(t.Percent*length)
elseif t.Type == "decelerate" then self:decelerate(t.Percent*length)
elseif t.Type == "spring" then self:spring(t.Percent*length)
elseif t.Type == "bouncebegin" then self:bouncebegin(t.Percent*length)
elseif t.Type == "bounceend" then self:bounceend(t.Percent*length)
elseif t.Type == "smooth" then self:smooth(t.Percent*length)
elseif t.Type == "drop" then self:smooth(t.Percent*length)
--elseif t.Type == "ease" then self:ease(t.Percent*length)
elseif t.Type == "bezier" then
-- todo: handle using tween and 'TweenType_Bezier'
end
end
end
-- Hide if b is true, but don't unhide if b is false.
function Actor:hide_if(b)
if b then