Quote:
|
Quote:
120 fps: approx. elapsed = 1/120 = 0.0083333333333333s per OnUpdate ( called frequence g in rest of text ) sampling frequency f = 0.25 Hz (or 4fps = 1/4Hz) f = 30*g so every 30-frame((n*30)%120, n<-N{0,1,2,..) the SinusFunction() is called - at this point it works fine now think of ppl having an average fps of not 120fps - like you said 10fps drawing frequency h = 1/10 Hz sampling frequency f = 0.25 Hz resulting that point of collide = frame2.5, as there is no frame 2.5, it will take frame 3 (>=) time between frame2.5 and frame3 is t=((frame3-frame2)/2); frame2 is drawn after 0.2s, frame3 after second 0.3 (on time graph) - would result in a 0.05s delay so with last_update=0, it will result in: frame1 drawn - frame2 drawn - frame3 drawn - function fires, last_update is now 0 again - frame4 drawn - frame5 drawn (NOW it should fire again - but it doesn't as this is again 0.2 not 0.25) - frame6 drawn - function fires and again 3 frames required with last_update=last_update-sampling_frequency: frame1 drawn - frame2 drawn - frame3 drawn - function fires, last_update now is 0.05 - frame4 drawn (last_update 0.15) - frame5 drawn(last_update 0.25) - function fires correctly at (50% of fps as it should with sampling frequency 0.25 - and not at 60%) - frame 6 drawn - etc... and ppl have not an average fps of continuously 120fps (atleast not the most have) |
Quote:
|
Quote:
Code:
do Code:
do |
Quote:
nah i meant this : Code:
do Quote:
|
Oh I see... That's pretty amazing :P
I still think though that using sin every quarter of a second isn't NEARLY as efficient then multiplying by -1. And I see the disadvantage of my function, it uses SetAlpha WAAAAAAAAAY too often. This should be much much more efficient. Code:
frame.mult = 1 #1 Code:
self.tslu = self.tslu + elapsed Code:
self.tslu = self.tslu + elapsed |
Quote:
i would say permanently incrementing of a variable may cause an overflow (dunno about max value in lua) - as you aren't calc the modulo and store it Code:
self.tslu = (self.tslu + elapsed)%.25 |
If I hadn't stopped playing atm I would post you an example with the animation system.
Using onUpdates to do this is out of date. |
Quote:
|
Sorry for thread hijack, but how can this code be applied to a single animation instead of a looping 'pulse'? I'm trying to add opening/closing animations to some addon frames, for example in the following code:
Code:
local function Stuffing_Open() |
Quote:
frame:SetScript('OnShow', doSomethingOnShow) or frame:SetScript('OnHide', doSomethingOnHide) ? |
Quote:
|
Use the built-in animation code:
Code:
local alpha = animationGroup:CreateAnimation("Alpha"); |
Arrrr, sometimes thread necrotism is good stuff, indeed. I somehow missed this one. *bookmarks thread* :D
|
Quote:
|
If you wanted to use the Blizzard animation API in XML, you could do something like:
Code:
<Frame> |
All times are GMT -6. The time now is 11:51 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI