Motorola maxx V6 manual Draft Subject to Change 108/201, Authoring M3G files

Models: maxx V6

1 201
Download 201 pages 31.32 Kb
Page 108
Image 108

Java ME Developer Guide

Chapter 13 - JSR-184 - Mobile 3D Graphics API

on several objects, the tracks are grouped together using the AnimationController object. This allows the application to control a whole animation from one place.

All the currently active animatable properties can be updated by calling animate() on the World. (You can also call this on individual objects if you need more control). The current time is passed through to animate(), and is used to determine the interpol- ated value to assign to the properties.

The animate() method returns a validity value that indicates how long the current value of a property is valid. Generally this is 0 which means that the object is still being animated and the property value is no longer valid, or infinity when the object is in a static state and does not need to be updated. If nothing is happening in the scene, you do not have to continually redraw the screen, reducing the processor load and extending battery life. Similarly, simple scenes on powerful hardware may run very fast; by restricting the frame-rate to something reasonable, you can extend bat- tery life and are more friendly to background processes.

The animation subsystem has no memory, so time is completely arbitrary. This means that there are no events reported (for example, animation finished). The ap- plication is responsible for specifying when the animation is active and from which position in the keyframe sequence the animated property is played.

Consider a world myWorld that contains an animation of 2000 ms, that you want to cycle. First you need to set up the active interval for the animation, and set the posi- tion of the sequence to the start. Then call World.animate() with the current world time:

anim.setActiveInterval(worldTime, worldTime+2000); anim.setPosition(0, worldTime);

int validity = myWorld.animate(worldTime);

Code Sample 8

13.4.7 Authoring M3G files

DRAFT - Subject to Change [108/201]

Page 108
Image 108
Motorola maxx V6 manual Draft Subject to Change 108/201, Authoring M3G files