This is a child page. You can use Parent in the quick nav bar at the top or the bottom of the page to navigate directly back to the parent of this page. Some child pages are more than one level deep, and in that case will require more than one Parent click to reach the outermost document level.

§ 16.90.5.24 - keys (SceneScript element)

 <keys A B[ C D]

"name" is required. A, B and the optional C,D...E,F... pairs may be expressions.

The  <keys language element is the means used to implement object animation through control of parameter values as they relate to frames of an animation.

Values are pairs: A, a frame number (this is treated as an integer value), followed by a B, a floating point numeric parameter. Note that expressions are allowed in  <keys statement values, which enables  {keys}  to use one another's values. However, in order to use a value from one  <keys statement inside another, that value must have been defined prior to its use, or it will evaluate to zero.

 Warning:

There are specific restrictions on the first parameter, the name of the variable. It may be up to 30 characters in length, and must be placed in quotes. Variable names must be alphabetic, numerals are not allowed. Variable names should not begin with the characters "e" or "E".

Ideally, you would know the exact length of the animation you plan, and set the keys up for the exact frames you want. However, this is not always possible (and there are other reasons why the keys might not be exact... such as needing to generate a shorter animation to see if the general motion is correct — a lot of time can be saved that way.) So F/x will check the framenumber in the last frame of each  <keys statement. If the last frame is not the same as the animation length being generated, all frames in the tween will be scaled to be as close as possible to the correct frame number (proportionally speaking) in the current animation. it is always better to have a longer tween specification than the animation length, rather than a shorter one, as the correction can be more accurate. We'll point out a practical example below.

 <keys allows you to provide a list of keyframed values that may be used in place of any numeric parameter in any other command (not inside other keys commands!)

You can put one or more values in a variable. Here is an example of a single value use by name. Note the specification of the frame where the value starts, followed by the value:

 <keys "yrotation" 1 180

Here is an example of how to set up a linearly interpolated value with several keys designed specifically for a 120 frame animation:

 <splined 0  <keys "yrotation" 1 0 60 45 120 357

Here is an example of the same keys, splined:

 <splined 1  <keys "yrotation" 1 0 60 45 120 357

Both of the above examples set up a rotation parameter that slowly changes from 0 to 45 degrees from frame 0 to frame 60 (half way through the animation) and then changes from 45 degrees to 357 degrees in the last half of the animation, from frame 60 to frame 120.

You might then use this in the scene as follows:

 <rotate 0 yrotation 0

Note the lack of quotes when using the keyframed variable; you only use quotes to define the variable.

It is very important that you begin each keyframe set with frame 1, and if there are more than one key in the set, it is critical that the last key specifies the last frame of the animation. You can place keys anywhere in between, at any or all frames.

Further detail on the automatic length corrections...

In the above example, which was designed for 120 frames, F/x can and will automatically rescale all the frame numbers when the actual sequence length in the program differs from the  <keys statement. For instance, if you set up for a 60 frame timeline and filmstrip, all the frame numbers will be scaled by 1/2. Frame 120 will be applied in frame 60, frame 60 at 30, and so forth. If you set up for an animation, frame 120 will be applied at frame 240, and so on. While the correction is made as best as possible, it is still best to design the so that they are exact for the target length of the animation — this allows you the most precise control of all your parameters.

There is a fairly simple method you can use to explicity control frame numbers over a large number of keys statements; it is practical as long as there aren't a large number of key frames. Basically, instead of using a number to specify the frame numbers, you can use variables instead. For instance:

 <keys "yr" 1 0 90 300 120 357

...sets up a 120 frame key with a keyed frame at 3/4ths. But so does this:

 <keys "lastframe" 1 120  <keys "tqframe" 1 90  <keys "yr" 1 0 tqframe 300 lastframe 357

...with the benefit that when you change the "lastframe" and "tqframe" variables, the "yr" variable changes too. In the case where a number of parameters are being changed and keyed against the 3/4ths point and the first and last frames, this mechanism could be used to explicitly change the keyframe values for all keys involved. This in turn ensures that the calculations for the keys are precise at all times.

See also the  <splined language element and the expressions section of the documentation.

Keyboard Navigation
, Previous Page . Next Page t TOC i Index o Operators g Glossary
WinImages F/x, Morph and all associated documentation
Copyright © 1992-2007 Black Belt Systems ALL RIGHTS RESERVED Under the Pan-American Conventions
WinImages F/x Manual Version 7, Revision 6, Level A

Valid HTML 4.01 Loose
 

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses python 2.7
Page 196
box