views:

356

answers:

0

I have a project using ruby on rails and scriptaculous. I have a periodically running scriptaculous animation running that involves continuously moving elements across the screen.

When a user clicks a certain button, I also want to fade a piece of text ontop of this animation asynchronously.

However, when I run the scriptaculous appear/fade command, it interrupts the move animation. The animation doesn't continue until the fade is complete. Everything I read online says these visual effects are asynchronous but it doesn't seem that is the case. Can anyone help?

In my main index.rhtml:

    <%= periodically_call_remote( :url => {:action =>:update_card}, :frequency=>1.0, :condition => "cur_speed==1.0" ) %>
<div class="example" id="demo-effect-fade" onclick="new Effect.Fade(this); window.setTimeout('Effect.Appear(\'demo-effect-fade\', {duration:3})',2500);">
        <span>Click to Fade Text</span>
 </div>

In update_card.rjs, which controls the animation:

 page.visual_effect :move, :shown_card, { :x=> 200, :y=> 300,  :mode=> "'absolute'", :duration=>session[:speed]/2.0}

I hope I supplied enough info. Let me know if you all have any ideas.