Animations

Advanced - Not for the faint hearted

Bringing balls to life!

Without animations balls seem rather lifeless and flat. They do not wobble or stretch or do anything that makes them appear to be made of Goo.
Obviously it is sometimes desirable to have them appear "lifeless", Bones, Bombs, Blocks etc...
But for balls made of Goo the animations are really the thing that brings them to life!

<sinvariance>

The tags hold information about the variation of the aniamtions (from ball to ball) and contain sinanim tags which actually describe the animations.

When each ball is created, the game selects a random value for each of the variance attributes [0 -> variance]
This is then applied to all the corresponding attributes in each of sinamin tags the sinvariance contains.

Setting all the variance attributes to 0, will make every ball animate in exactly the same way, at exactly the same time. This looks a bit odd.

You should take care that the variance values are less than the values set in the sinanim tags.
If the variance is equal (or greater than) the sinamin value this can result is very strange effects, such as negative scaling.. where the ball shrinks to a point, then expands again as its mirror image, then shrinks to a point and expands back to its normal appearance.

amp : Float : Required : "Sane" Range 0 -> 1
The amplitude variance
Original Balls used values from 0 -> 0.1
freq : Float : Required
The frequency variance in Hz (oscillations per second)
Original Balls used values from 0 -> 1.5
shift : Float : Required : Range 0 -> 1
The phase shift variance, 0.5 = 180° 1 = 360°
Original Balls mostly used 0, but some have 0.5 or 0.8

<sinanim>

These tags define elements of the balls animation. Each element is a simple sinusoidal oscillation, but when several are combined (correctly) the resultinf animation can be quite complex.

part : list-of-{Part Name} : Required
The name or names of the ball <part>s to which this animation is applied
state : list-of-{State Name} : Required
The state, or a comma-separated list of several, for which this animation is applied
For your sanity, we recommend that you select the same state / states for every sinanim within a sinvariance
type : scale or translate : Required
The type of animation
axis : x or y : Required
The axis, relative to the ball's default upright position, along which the animation is applied
amp : Float : Required
The default amplitude of the oscillation, the actual amplitude will be modified by the variance.
For scale type animations this is the scale factor amplitude
For translate type animations this is a pixel distance and can be positive or negative.
freq : Float : Required
The default frequency of the oscillation in Hz, the actual frequency will be modified by the variance
shift : Float : Required : Range 0 -> 1
The default phase shift for this oscillation, the actual phase shift will be modified by the variance.
The shift is in the range 0 = 0° 1 = 360°

Experimention is the key to understanding

These are not easy concepts to understand, and its difficult to explain how these animations will work and the effects they will produce when combined.

Your best bet is...
Take an original ball... simplify it, so it has only a single sinvariance and sinanim.
Set the sinvariance values to 0, and have try out some values in the sinanim.

Once you think you've "got" that, add some variance, or a second sinanim tag... and play with that...

Eventually you'll "get it", and be able to produce all sorts of weird and wonderful things.

Alternatively.. just clone an existing ball, and keep whatever 2DBoy had set! Wink