Animation:SetSmoothProgress

From Warcraft Wiki
Jump to navigation Jump to search

Sets the smooth progress for an animation.

Animation:SetSmoothProgress(smoothProgress)

Arguments

smoothProgress
number

Example

API Animation SetSmoothProgress.gif
-- Create a Button with a significant bounce effect.
if not SetSmoothProgressExample then
   local frame = CreateFrame('button', "SetSmoothProgressExample", UIParent)
   frame:SetPoint("TOP", 0, -30)
   frame:SetSize(200,100)
   frame.bg = frame:CreateTexture()
   frame.bg:SetColorTexture(0,0,0,1)
   frame.bg:SetAllPoints()
   frame:EnableMouse(true)
   frame:RegisterForClicks("AnyDown")
end

local function smoothing(self)
   local p = self:GetSmoothProgress()
   local c = p^p
   self:SetSmoothProgress(c)
end

SetSmoothProgressExample.animationGroup = SetSmoothProgressExample:CreateAnimationGroup()
local scale = SetSmoothProgressExample.animationGroup:CreateAnimation("Scale")
scale:SetScaleFrom(0,0)
scale:SetScaleTo(1,1)
scale:SetDuration(0.1)
scale:SetScript("OnUpdate", smoothing)
SetSmoothProgressExample:SetScript("OnClick", function(self)
      self.animationGroup:Play()
end)