Name
Pass

13. Animation action overview

12. Sequences | | 14. Scripting

While animating the excavator character I showed the use of four different animation actions. In this chapter I will list and explain the remaining animation action types. The only exception will be the script animation action. This one gets its own chapter due to its 'advancedness'.

I will not be demonstrating all animation actions, I leave that to the collection of sample projects you'll find in the LD4DStudio's installation folder.

To keep the list of animation actions complete, actions discussed elsewhere will be present by reference.

iconMutate actionicon

Handled elsewhere

iconMove to actionicon

Handled elsewhere

iconInc actionicon

Handled elsewhere

iconAcceleration actionicon

The acceleration action is basically a non linear inc action. It takes a start and end speed and increases the linked analog animation element in such a way it rate of increment goes from the start to the end speed. If the end speed is lower then the start speed it will act as a deceleration action.

This action is primary used in combination with normal inc actions. It can then be used to simulate the acceleration or deceleration before / after the continued linear changes made with the inc action. See the 'helicopter' sample for example usage.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
DurationSame as other actions.
Start speedThe speed to use as a base, usually this is 0. Or in case of a slowdown, the speed set in the previous used inc action for this animation element.
End speedthe speed wanted at the end of this actions influence. This is usually equal to the speed set in a following inc action for this animation element.

iconCalculated actionicon

The calculated action is one of the most powerful animation actions. With it you can mutate one analog animation element based upon one or two others. To this end you can assign two sources (A and B) and choose an operation to apply to them. Possible operations are:

  • Plus (target = sourceA + sourceB)
  • Min (target = sourceA - sourceB)
  • Multiply (target = sourceA x sourceB)
  • Divide (target = sourceA / sourceB)
  • Absolute (target = absolute value of sourceA, removes minus sign if present)

If you omit sourceA or sourceB it uses the value property instead. So if you assign only sourceB and use value 15 with the multiply operation you get: target = 15 x sourceB

This action is extremely helpful while animating mechanical dependencies like gears.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
Source AFirst source analog animation element to use in the calculation.
OperationOperation to apply on sources or source and value.
Source BSecond source analog animation element to use in the calculation.
ValueConstant to use instead of one of the sources if one of them in is missing.
DurationSame as other actions.

iconCalculated inc actionicon

The calculated inc action is much like the normal inc action. It lets you increase an analog animation element value over time by a certain amount, but with this action the 'amount' isn't constant. It depends on a source analog animation element and operation with a constant.

This basically gives you a gas pedal you can use to influence e.g. the wheel rotation speed of a car. This can be extra fun while playing around with joysticks in simulated playback mode.

Possible operations are

  • None (internal 'inc' value = source)
  • Plus (internal 'inc' value = source + value)
  • Min (internal 'inc' value = source - value)
  • Multiply (internal 'inc' value = source x value)
  • Divide (internal 'inc' value = source / value)

Its properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
SourceThe source element to base the internal 'inc' value upon.
OperationOperation to apply to the source and value to obtain the internal 'inc' value.
ValueConstant to use with the source and operation.
IntervalTime span to increase the value with the internal 'inc' value.
DurationSame as other actions.

iconFrequency generator actionicon

The frequency generator action gives you wave driven value control over an analog animation element. Most animation actions are linear and because of that movement of character may feel 'unnatural'. By using e.g. the sine wave to move the legs of a minifig it will look much more realistic.

You have full control over the wave form and amplitude. You can choose from several kinds of waves, namely:

  • Left saw
  • Right saw
  • Sine
  • Triangle
  • Block

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
RelativeDetermines if the wave value is put on top of the start value (relative) or it will BE the value (absolute).
DurationSame as other actions.
Wave kindWave kind to use.
AmplitudeStrength of the wave. If for example you choose 90 the result value will vary between -90 and 90.
Amplitude offsetOffset to use on strength. If you choose 10 and have 90 for the amplitude, the value will vary between -80 and 100.
FrequencyNumber of times the result value will follow the base pattern in a second.
Wave offset in degrees.Let's you choose if you want to define the wave offset in milliseconds or degrees.
Wave offsetStarting point of the base pattern in ether milliseconds or degrees depending on the previous property's setting. If set in milliseconds and, for example, you want to start the wave at a quarter offset (90 degrees) while the frequency is set to 2 you should specify 125 (1000/2/4). but as you see using the degrees notation might be easier, it's also frequency independent.

Waves can be hard to grasp, if you're not used to them. To assist you with this, the frequency generator action has a window for its object. This window lets you play with the wave parameters while giving you visual feedback on the implementations.

frequency generator window

The window is fairly simple. There are edit boxes for the wave properties, an example rendering of the wave and two buttons. The 'apply' button must be clicked if you want to save the current wave settings to the action' properties. The 'restore' button resets the window to the current object properties.

The 'Render wave duration' checkbox can be used to choose between previewing a single period (the default) or the wave behavior during the whole length of the action. It can only be checked if the action isn't non stop.

iconFreehand actionicon

Like the frequence generator action this action is used to control a analog animation element using a wave. But with the freehand action you can draw that wave yourself, this can be handy for 'random' spastic movements like to use for a minifig arm's.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
DurationSame as other actions.
Segment countUsed to divide the duration into sample points, these samples are then set by you while drawing the graph. The more segments (and thus samples) the more accurate you can draw a wave.
Round toThis is used to round all drawn sample values to set fraction, in order to keep them on a grid.
Value to use for new samples.
Min valueMinimum value you can use in the graph.
Max valueMaximum value you can use in the graph.

Most of the above properties don't make much sense on their own, this is because you will be doing the most work for a freehand animation action in it's editing window. It can be opened by double clicking the action you want to edit. Doing so will open a window like the one below (do note this is an configured action in order to give you a better visual example.).

freehand window

This window is basically a big piece of blocked paper, you can use to manipulate the samples in the set time duration. To aid you in this work there are a number of tools accessible via the buttons at the top.

freehand window toolbar

Above buttons have the following functions:

1Open zoom menu.
2Zoom in horizontal only.
3Zoom out horizontal only.
4Zoom in vertical only.
5Zoom out vertical only.
6Toggle mouse mode. This determnes if mouse clicks in the grid area will control the selection or 'redraw' the wave.
7Deselect current selection.
8Delete current selection.
9Insert silence on current position.
10Replace current selection (or whole range if none) with silence.
11Replace current selection (or whole range if none) with 'noise'.
12Replace current selection (or whole range if none) with a 'normal' frequency wave.
13Load a previous saved freehand pattern into the current selection (or whole range if none selected).
14Save the current selection (or whole range if none) to file for later (re)use.

Zooming is quit strait forward, you use it to get a view of your liking to work with (part) of the wave. Button #6 is best understood by clicking just trying. So click on the grid with your left mouse button and hold it down. If you now move it around you will see a green region being controlled. This is the current selection. If you now let go of the mouse and click the #6 button and do this again you'll see the red line will be redrawn following your mouse movement.

In selection mode you can also resize the selection by clicking and dragging the outer edges of the selection around or move the whole selection (including the values it represents) around by clicking middle of it and moving your mouse to the left or tight.

In both selection and drawing mode you can manipulate a single sample by clicking and moving it's bit red dot around, but do mind these 'dots' are only visible if the current horizontal zoom isn't to far out. So if you don't see the dots use the #2 button to zoom in until they appear.

To get the red line to a pattern that suits your needs you can use buttons #8 through #12. First there us #8, it will remove the current selection causing everything behind it to move to the left. The leftover at the right as a result of the lost space will be filled with the rest value.

Button #9, can be used to insert a silence at the current position. To get a current position you'll need to click the mouse once at the desired position in selection mode. Clicking the button will open the following dialog.

freehand window insert silence dialog

This dialog lets you set the length of the silence you want to insert in two ways. You can ether give the number of samples you want, or the duration in milliseconds. But do mind in case of milliseconds thing will be round based upon the segment length (action duration divided by segment count). Finally you choose the value to use for the inserted samples. This defaults to the rest value.

When all is to your liking clicking 'ok' will insert silence causing to move everything right from the selection position to move in order to make room for the new silence.

Button #10 is much the same as #9 but instead of inserting silence you will be replacing the current selection (or the whole thing if no selection is active) with a value of choice. Clicking the button will open a tiny dialog only asking for the value to use, it defaults to the rest value.

Button #11 is used to generate a wave in a way we used to from the frequency generator action. This is handy of e.g. setting a basic shape. Clicking it will open the below dialog.

freehand window generate frequency dialog

The options you can set here are identical to the similar named ones in the frequency generator action, so I'm not going to reexplain them here. Only additional thing worth mentioning is the 'fit wave' button at the bottom right. You can use that to set the wave's frequency in such a way it will fit a single period in the given time frame (ether the selection or action duration).

Samples and segments

You might be wondering what the difference is between samples and segments, because I have been a bit vague about that. Segment count is used to indicate in how many pieces you want to divide the given duration (aka resolution). A sample is the value you set for the begin of each of those pieces and at the end of the last one. So you will always have (segment count + 1) samples. That last one is needed so the animation engine knows what to assign if the duration has been passed.

This is pretty much it for the freehand aniaction, the best way to get the hang of it is to just 'play' with it awhile. For some examples you could look at the pneumaticDemo sample. It uses freehand action to create non linear movement of an extending pneumatic cylinder.

iconSequence reference actionicon

The sequence reference animation action is a very important organizing and reuse ability tool. With it you can apply other actions from another sequence during the length of the reference action.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
SequenceThe sequence to apply. The select dialog will exclude the current sequence. You can select sequences from other animations, but keep in mind you need to create mappings (more on that below) for them to have any effect.
DurationSame as other actions.
LoopWhen enabled, a shorter sequence will be repeated after it finishes during the action's duration. If the target sequence has the 'non stop' property enabled, the loop property will be ignored (You can't loop infinity).

Often you want to do an animation which includes e.g. a walking minifig. The walking sequence is stored in a sequence which you can reuse from other sequences. But what if you want a different minifig character to walk? You would think you have to create the same sequence using different animation elements.

Luckily this is not necessary, it is possible to apply another sequence's actions while using different animation elements in those actions. This is done by 'fooling' the sequence using mappings.

For example: You've got a whole bunch of actions manipulating character "minifig1" in the target sequence. But you want to animate minifig2 the same way in the current sequence. For this to work you have to map all minifig2 animation elements to minfig1. This way when the referenced sequence manipulates e.g. minifig1.leftLeg.angles.y it will actually be changing minigig2.leftLeg.angles.y

Mappings are done on object level (lights, cameras, characters, etc) to spare you the work of creating a mapping for each and every animation element separately.

You can manage the mappings for a sequence reference with a special dialog. This dialog is opened from the "Reference mappings" object below the sequence reference action object.

mapping dialog

The mapping dialog gives you an overview of all local animation objects at the left. At the right you'll find all objects used in the target sequence. You now can use the two lists to create unions. This is done by clicking an item in the left and right lists and if they are compatible you will be allowed to click the 'add' button. After having been added, the mapping will appear in the center list.

To edit an existing mapping click it in the center list, then adjust its left and right list item at will. Click 'modify' to keep the changes for the mapping. To delete a mapping select it and press 'delete'.

iconBinary mutate actionicon

The binary mutate action is used to instantly change a binary animation element's value. It's of course the binary version of the normal mutate action. You can use it to initialize or transform the value. Transforming is done by choosing an operation and optionally setting a second value. Available operations are:

  • Set (initialization, target = value)
  • Not (flips the target value, if true it becomes false and visa versa.)
  • Or (target = target or value, if one is true target will be true.)
  • And (target = target and value, both must be true for target to become true.)
  • Xor (target = target xor value, only one must be true for target to become true.)

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
OperationBinary operation to perform.
ValueConstant to use in binary operation.

iconBinary calculated actionicon

The binary calculated action is used to mutate one binary animation element based upon one or two others. To this end you can assign two sources (A and B) and choose an operation to let go on them. Possible operations are:

  • Or (target = sourceA or sourceB, if one is true target will be true.)
  • And (target = sourceA and sourceB, both must be true for target to become true.)
  • Xor (target = sourceA xor sourceB, exactly one must be true for target to become true.)
  • Not (target = not sourceA, target becomes opposite of sourceA. sourceA will be used if set, otherwise sourceB.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
Source AFirst source binary animation element to use in the calculation.
OperationOperation to apply on sources or source and value.
Source BSecond source binary animation element to use in the calculation.
ValueConstant to use instead of one of the sources if one of them is missing.
DurationSame as other actions.

iconBinary frequence generator actionicon

The binary frequency generator action is used to continually flip a binary animation element's value using according to a pattern over time.

Its properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
IntervalTime between flips or period time depending on start mode.
DurationSame as other actions.
Start modeHow to start / apply the pattern. See below for more infomration about this.
PatternBit pattern to use. This is a string of '0' and '1' characters. '0' is used to represent false and '1' for true.

Like the 'start mode' and 'pattern' properties suggest, there are a number of different start modes available resulting in different kinds of behavior. Lets go over all of them.

Pattern bitsThis will apply the pattern's absolute values to the animation element on bit per interval. So if the pattern is '0101' the element will be set to 'false true false true' and then repeat.
RelativeLike 'pattern bits' the pattern will be used to change the animation elements value every interval of time, but it will only use it as a guide of 'when to flip'. So if the current value is true and the pattern is '0101', the value will be manipulate to 'true, false, true, false'. It starts with true and not false because the animation element value (true) and not the first number (0) in the pattern will govern the start value used with the pattern. Also note two bits of same type in order will not trigger a flip. So '01001' will result in 'true false true true false' in the otherwise identical situation.
TrueLike 'relative' but always start with true, and so ignoring the element's start value.
FalseLike 'true' but always start with false instead.
Pattern waveApply the entire pattern within a single interval. For example if the pattern is '0101' the animation element will be manipulated as 'false true false true' evenly timed within the set interval. So if the interval is 500 ms and the pattern consists of 4 'bits' the animation value will be changed accordingly every 125ms. This will then be repeated until the duration is reached.

These patterns and the current set start mode can be tricky to completely understand, but I don't think it's something a little bit of experimenting can't solve.

iconCompare actionicon

The compare action is used to set a binary animation elements value by comparing two analog animation elements values. The possible compare operations are:

  • Equal (target is true if: sourceA = sourceB)
  • Unequal (target is true if: sourceA <> sourceB)
  • Above (target is true if: sourceA > sourceB)
  • Above or equal (target is true if: sourceA >= sourceB)
  • Below (target is true if: sourceA < sourceB)
  • Below or equal (target is true if: sourceA <= sourceB)

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
Source AFirst analog animation element source.
OperationCompare operation to apply.
Source ASecond analog animation element source.
ValueConstant to use instead of a missing source.
DurtationSame as other actions.
PrecisionAnalog values can be very precise. This means values can differ only slightly from each other (like e.g. 10.00001 and 10.00003). Being this precise results in many 'unwanted' false results. To correct this problem you can control the number of decimals to include in a compare.

iconRegion compare actionicon

The region compare action sets a binary animation element by doing a regional compare on an analog animation element. This means the target will be true while the source value is in a certain region.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
SourceAnalog animation element.
OperationOperation to use.
DurtationSame as other actions.
FromRegion start.
ToRegion end.

iconObject init actionicon

The object init action .

Most animation actions manipulate only one animation element. But in some cases you'll find you need to manipulate just about every element in e.g. an character at once in much the same way. Initialization is such a case, so to help keep the number of animation actions down there is the object init action. It let's you initialize all animation elements associated with an high level object (character, camera etc) at once.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetThe object who's elements you want to initialize.

The only interesting property is the target one, use use it to assign a character, camera or other high level object to the action. After setting it, you are ready to edit the actual animation element values you want to initialize to, using the objects in the object's 'values' subbranch. Please not only enabled elements will be present in the list of elements.

Each object in that list has only two properties, namely: 'apply' and 'value'. 'Apply' determines if you actually will be using the element for initialization in the action and 'value' of course contains the value you want the linked element to change to whenever this action is processed.

Configuring all the elements can be done in an easier way by using the 'object init' actions edit dialog. You open this by clicking the '[ ]' button visible when the object is selected in the tree. Done so will open a dialog like below, please note I assigned a camera to the action for this example.

Object init action edit dialog

The dialog is fairly straight forward, you can edit the 'apply' and 'value' setting for all associated animation elements at once by using the grid. There are three special buttons whom let you set all selected elements value at once. 'Clear' will set them to '0' or 'false', 'Rest' will assign the rest values and 'Current' will assign the linked animation elements current values.

Opening the right mouse button popup menu will give you two more mass property changing tools, whom apply to the 'apply' property.

iconObject follow actionicon

The object follow action, just like the object init action, influences all animation elements of a higher level object at once. But this action can be used to let e.g. one character mimic another character's movement. this is handy for things like a parade of minifigs (see the parade sample). You only animate one minifig and all others will follow that one's movements.

It's properties are:

NameSame as other actions.
EnabledSame as other actions.
OffsetSame as other actions.
TargetSame as other actions.
SourceThe object you want the target object to follow.
DurationSame as other actions.

Just as the other object action the real settings are done in the 'value' subbranch or with a special edit dialog. Lets take a look to the dialog, you open it by clicking the '[ ]' button in the action's property editor toolbar. It should look something like the picture below. Please note I did assign a camera object to the 'target' and 'source' properties first.

Object follow action edit dialog

The dialog is very similar to the one of the 'object init' action. But here you can only control the 'apply' state of assigned animation elements. The 'apply' property can be very important, cause you rarely want two objects to fully mimic each other. Take for example the parade fully mimicking each minifig from a single master will result in 'seeing' only one minifig because they will all be rendered on the same location. This will be prevented by disabling the 'apply' property for some of the position animation elements.

In conclusion there are two buttons you can use for mass changing of the selected elements their 'apply' property.

iconScript actionicon

Handled elsewhere

iconCamera actionicon

Handled elsewhere

12. Sequences | | 14. Scripting
Best viewed with Firefox 2, Seamonkey or IE 7 at 1024x768 or higher resolution.
 
LEGO is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this website.