- Parallel Effect


This is a special effect to combine more than one core effect into a parallel effect. It's the only effect that doesn't take an element as first parameter, but an array of sub-effects.


You can use one of the following two forms to use this effect −

new Effect.Parallel([array of subeffects], [options]);

Effect-Specific Parameters

This effect does not have any specific parameter except the common parameters.


      <title> examples</title>
      <script type = "text/javascript" src = "/javascript/prototype.js"></script>
      <script type = "text/javascript" src = "/javascript/scriptaculous.js?load = effects"></script>
      <script type = "text/javascript">
         function ParallelEffect(element){
            new Effect.Parallel(
               new Effect.MoveBy(element, 100, 200, { sync: true }),
               new Effect.Scale(element, 200, { sync: true })
            {duration: 2}
      <div onclick = "ParallelEffect(this)">
         Click me to see the result of Parallel Method

You specify the effects as a first argument to the constructor, passing in an array of the effects to be run synchronously. Those effect objects must have been created with their sync option set to true.

Note that the effects do not necessarily pertain to the same element; however, there is only one duration (or fps rate, for that matter) - the one set at the Effect.Parallel level; synchronized effects will all step ahead in unison.

This will produce following result −