Well, I have made a lot of progress, however I have problems doing the
transition between effects, I REALLY need some help with this. The diff
is on http://www.railsdevelopment.com/code/pair.diff ...
I think we need to do some put all setup that modifies the dom object to
aftersetup (and only call that when we don't do a transition). But I
need some reviewing of the current code....
Abdur-Rahman Advany wrote:
Well after struggling a bit with how to do it, I have a few problems.
1. I will need to determine the queue where the effect is added to (I
think I will need to set the value of Effect.queue).
2. I need to know the type of effect and see if its in the PAIR array
and find its opposite
3. Check if the processed effect is the opposite of the currently
active effect
4. Call the pair method (doesn't exist yet') of the 'idle' effect with
the 'active' effect as argument
5. Let the pair method switch the internal values of the active effect
to the idle effect
6. Cancel the 'active' effect and remove it from queue.
I have made a diff with the basic structure
(railsdevelopment.com/code/pair.diff). I really need some help here
with 2, 4 and 5. Especially 5 because its really hard (apart from the
Fade/Appear) to determine what are the internal values. Some are
hardcoded into the Before/AfterSetupInternal so that will need to be
fixed.
thnx,
Abdur-Rahman
Abdur-Rahman Advany wrote:
Peepz,
I was looking into how script.aculo.us handles effect to write a
tutorial and for a current project I wanted to make transition
between PAIR effects possible. These PAIR effects are (Appear/Fade,
SlideUp/SlideDown, BlindUp/BlindDown) the effect that toggle can handle.
script.aculo.us calls queue.loop each 40 milliseconds, and that calls
all the effect.loop for all effects in the queue. Then Effect calls
render and calls setup when its idle and calls update (with position)
when its running. *update* does what the effects should do (fade,
scale or move) and its called with the pos parameter 25 times a
second. So know we have a problem, how does one calculate if a effect
in the same queue with the same dom its trying to activate itself
during the previous effect on the same dom.
I think there are 2 things we can do:
- Search the queue each time render is called for a effect and cancel
the queue if the effect is manipulating the same dom and its PAIR
effect of a other. I think this would kill the performance unless the
transition only happens when a option is specified.
- The second think what could be done is, passing on the effect that
is created to make the transition against. This would be much more
easy however it would talk more effect to use it.
What do you guys think? anyone have a other opinion?
Thnx,
Abdur-Rahman
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs