|
EffectSpiral
Effect.Spiral and its usage.
IntroductionEffect.Spiral, as its name suggests, is intended to be adpoted into the Scriptaculous family of events. Its closest relative is Effect.Move; indeed, Spiral is little more than a drunken variant of Move. While Effect.Spiral is bundled with Pinwheel, it's also available separately in a file startlingly called spiral.js. (But you'll still need Scriptaculous.) DetailsI was serious about Spiral being quite similar to Move. An element is provided, a location is specified, and said element moves to that location--albeit in curving-about sort of way. I won't rehash the Move stuff here: check the Scriptaculous Effect.Move docs for that. However, there are two options of which to be aware: arcDefault: Math.PI / 2 The arc option specifies the width of the angle through which the spiral will travel, measured in radians. Some useful radian values:
Angles larger than 2 * Math.PI are going to spin completely around more than once. It can rapidly start spiraling out of control (I'm sorry, I couldn't help it), but it can also look kinda cool. For the folks who don't think in radians, there's a convenience method appended to the number class, toRadians. Called like so: (45).toRadians(); // roughly 0.7853981633974483 (or pi / 4) directionDefault: 'clockwise' The direction option specifies the direction in which the spiral is going to twist. Valid options are 'counterclockwise' and 'clockwise' (the default). Actually, don't tell anyone this, but if you specify anything besides 'counterclockwise', you're gonna get 'clockwise'. |