Permalink
Browse files

rotation and fixes

  • Loading branch information...
1 parent 15102a3 commit a0231f644b9ec68f8807ca0fa11577dda19deaa7 @xconstruct committed Nov 12, 2009
Showing with 16 additions and 8 deletions.
  1. +15 −8 LibFx-1.1.lua
  2. +1 −0 README.mkd
View
@@ -6,14 +6,18 @@ License: GPL 2
Description: Animations! And these actually work ... unlike Blizz' ones
]]
-local MAJOR, MINOR = "LibFx-1.1", 3
+local MAJOR, MINOR = "LibFx-1.1", 4
local LibFx = LibStub:NewLibrary(MAJOR, MINOR)
-
if not LibFx then return end
local ramps, anims, running = {}, {}, {}
local numRunning = 0
+local mt = {
+__index = LibFx,
+__call = function(self, ...) self:Start() end,
+}
+
--[[*****************************
LibFx:RegisterAnimation(name, func, startFunc)
@@ -60,10 +64,6 @@ end
Creates a new fx-object
- fx = table holding options
*******************************]]
-local mt = {
-__index = LibFx,
-__call = function(self, ...) self:Start() end,
-}
function LibFx.New(fx)
assert(fx, MAJOR..": No fx-table specified")
fx = setmetatable(fx, mt)
@@ -169,10 +169,17 @@ end, function(fx)
end)
LibFx.RegisterAnimation("Width", function(fx)
- fx.start = fx.frame:SetWidth()
+ fx.start = fx.frame:GetWidth()
fx.diff = fx.finish - fx.start
end, function(fx)
- fx.frame:GetWidth(fx.start + fx.diff * fx.progress)
+ fx.frame:SetWidth(fx.start + fx.diff * fx.progress)
+end)
+
+LibFx.RegisterAnimation("Rotate", function(fx)
+ fx.start = fx.frame:GetRotation()
+ fx.diff = (fx.rad or rad(fx.deg)) - fx.start
+end, function(fx)
+ fx.frame:SetRotation(fx.start + fx.diff * fx.progress)
end)
LibFx.RegisterAnimation("Translate", function(fx)
View
@@ -50,6 +50,7 @@ Default animations
* Scale: Scale the frame to the value of fxTable.finish
* Height: Set the frame's height to the value of fxTable.finish
* Width: Set the frame's width to the value of fxTable.finish
+* Rotate: Rotate the frame by the value of fxTable.rad (radians) or fxTable.deg (degrees)
* Translate: Move the frame by fxTable.xOffset and fxTable.yOffset
Default ramps

0 comments on commit a0231f6

Please sign in to comment.