View Single Post
02-06-10, 08:41 AM   #25
Hati-EK
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 20
Originally Posted by nightcracker View Post
What I say now I assuming you meant this:

Code:
do
	local last_update = 0
	local updater = CreateFrame("Frame", nil, UIParent)

	updater:Hide()
	updater:SetScript("OnUpdate",
			  function(self, elapsed)
				  last_update = last_update + .25

				  if last_update <= -.25 then
					  RunSinFunction()
					  last_update = 0
				  end
			  end)
end
Then that is equal to this:
Code:
do
	local start = 0
	local updater = CreateFrame("Frame", nil, UIParent)

	updater:Hide()
	updater:SetScript("OnUpdate", function(self, elapsed)
		start = start + .25
		SomeFrame:SetAlpha(math.sin(start))
	end)
end
Which means that the speed of the pulsing is determined by your FPS, not the amount of fluentness(is that a word?).

nah
i meant this :
Code:
do
	local last_update = 0
	local updater = CreateFrame("Frame", nil, UIParent)

	updater:Hide()
	updater:SetScript("OnUpdate",
			  function(self, elapsed)
				  last_update = last_update + elapsed

				  if last_update >= 0.25 then
					  RunSinFunction()
					  last_update = last_update-0.25
				  end
			  end)
end

Originally Posted by Torhal View Post
This is true, if you're looking to be precise.
well it's a sinus function - where little differences may cause weird results or atleast not nice looking ones

Last edited by Hati-EK : 02-06-10 at 08:44 AM.
  Reply With Quote