Setras Posted February 5, 2011 Share Posted February 5, 2011 Hi guys. I need a simple and nice way to make a widget blink like 10 times and stop blinking. Problem is... It's possible that there will be dozens of such widgets and i don't want to store a global var-table containing info about "how much times did certain widget blink"... And i want them to blink like... repeatedly... Let's share ideas about making it effective and fast? Quote Link to comment Share on other sites More sharing options...
Nikon Posted February 5, 2011 Share Posted February 5, 2011 Может использовать потоки? Стандартная библиотека coroutine подключена Quote Link to comment Share on other sites More sharing options...
ramirez Posted February 6, 2011 Share Posted February 6, 2011 Aloha! You can make yourself a little helper library, which basically will launch given sequence of effects, say Code: local sequence = {} for k = 1, 10 do table.insert( sequence, { 0.5, 1, 1000 + 50 * k, EA_SYMMETRIC_FLASH } ) end fxlib.PlayFadeEffectSequence( widget, sequence ) Each cell in this sequence is a set of arguments for AO Lua API widget method "PlayFadeEffect". It can be used like Code: local cell = sequence [ i ] widget:PlayFadeEffect( unpack( cell ) ) Library itself can register on demand a single handler for API event "EVENT_EFFECT_FINISHED", which will identify current playing sequence and launch effect for next sequence cell from library's internal hash. Something like Code: handlers [ "EVENT_EFFECT_FINISHED" ] = function( event ) local widget = event.wtOwner local instanceID = widget:GetInstanceId() local sequence = hash [ instanceID ] if sequence then local i = sequence.i or 1 local cell = sequence [ i ] sequence.i = i + 1 if cell then widget:PlayFadeEffect( unpack( cell ) ) else widget:FinishFadeEffect() hash [ instanceID ] = nil end end You can expand this approach on all types of widget effects in AO, and as outcome you'll get most effective and powerful AO user-made library ever existed. Cheers! =) P.S. Sorry for rubbish English, can't use Google translator. Quote Link to comment Share on other sites More sharing options...
Recommended Posts