View Single Post
01-07-19, 05:23 PM   #3
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Code:
local f = CreateFrame("Frame","AnimationByOnUpdate",UIParent)
f:SetSize(64,64)
local texture = f:CreateTexture(nil,"ARTWORK")
texture:SetAllPoints(true)
texture:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark")
texture:SetSnapToPixelGrid(false)
texture:SetTexelSnappingBias(0)

f.xpos = 0
f.xoffset = -300
f.speed = 0.01 -- 2=faster, 0.5=slower

local function translate(self,elapsed)
  self.xpos = self.xpos + (self.xoffset*self.speed*elapsed)
  self:SetPoint("CENTER",self.xpos,0)
  if self.xpos < self.xoffset then
    self:SetPoint("CENTER",self.xoffset,0)
    self:SetScript("OnUpdate",nil)
  end
end

f:SetScript("OnUpdate",translate)
  Reply With Quote