My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
OpenAndCloseEffects  
A closer look at the openEffects and closeEffects options.
Updated Mar 3, 2008 by dan.dor...@gmail.com

Introduction

A lot of the really cool magic of Pinwheel happens thanks to the openEffects and closeEffects options. It's where the opening and closing behavior is specified, for instance, as well as any other visual effects.

Details

The openEffects and closeEffects options are Javascript objects: each property of the object represents a Scriptaculous Effect to call on each choice element as the Pinwheel opens or closes. In turn, each object property is itself an object specifying the options for the corresponding Scriptaculous Effect. If a property is set to null, then the default options for that effect are used.

For example, Pinwheel's default openEffects options looks like this: { move: null }. That means that each choice element should be scooted out to its eventual destination using the default options for Effect.Move. Note that duration doesn't need to be set separately for each effect: the Pinwheel duration properties are used for that. Neither should you set the to option for the movement effects, Effect.Move and Effect.Spiral: Pinwheel calculates those.

A more interesting example:

{
  // other options
  openEffects: { spiral: null, opacity: { chosen: false, from: 0, to: 0.5 } }
  // other options
}

Which just means this Pinwheel uses Effect.Spiral to move the choice elements (instead of Effect.Move), and it also fades in the choice elements halfway.

Note the chosen option passed to opacity in the preceding example. That indicates whether the effect should be applied to the currently selected choice element (the default is true). So, in the example, the chosen one is exempt from the opacity effect applied to its brethren.

Powered by Google Project Hosting