|
JavaView® v2.12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Interface required for all objects who want to register itself in an animation manager.
Usage of animations:
anim.getAnimationPanel().setVisible(true)
and start animation from panel, or directly call anim.start().The following code describes how to register a dynamic object as animation. After the registration, the animation may be started from code or interactively from the animation manager's info panel. The info panel is available by calling anim#getAnimationPanel()#setVisible(true), or, if the manager is created inside a project, by registering the manager in the project via project#setAnimation(anim) and then pressing F4 or Strg-A.
Somewhere, e.g. in the initialization method of a project:
// The class DynSample is a user defined class to be animated. The
// class must implement the interface PsTimeListenerIf.
DynSample dyn = new DynSample();
// Create a new animation manager which will supervise the animation.
PsAnimation anim = new PsAnimation();
anim.setName("Sample Animation");
// Register the sample dynamic object within the animation manager
// as a lisener of timer events.
// In return, the animation will itself register as animation in the listener.
// This enables JavaView to display the animation panel of the listener.
anim.addTimeListener(dyn);
// Set initial time of animation. This will result in a call of dyn.setTime(0.).
anim.setTime(0.);
In DynSample.java:
// DynSample.setTime(PsTimeEvent time) should recompute the dynamic object
// according to the new current time.
public boolean setTime(PsTimeEvent time) {
// recompute dynamic object
...
// further, update itself to let the system know about its change.
update(this);
return true;
}
PsAnimation,
PsKeyframeIf,
PjProject,
MyProject| Method Summary | |
PsAnimation |
getAnimation()
Get the animation object where this listener is registered. |
java.lang.String |
getName()
Get name of listener object. |
boolean |
hasAnimation()
Check whether this object is registered as listener of an animation object. |
void |
setAnimation(PsAnimation anAnimation)
Assign the animation object where this listener is registered. |
boolean |
setTime(PsTimeEvent timeEvent)
Animation updates the dynamic object through this method whenever time has changed. |
| Method Detail |
public java.lang.String getName()
public boolean setTime(PsTimeEvent timeEvent)
public PsAnimation getAnimation()
setAnimation(PsAnimation).hasAnimation(),
setAnimation(PsAnimation)public boolean hasAnimation()
getAnimation(),
setAnimation(PsAnimation)public void setAnimation(PsAnimation anAnimation)
Only one animation object may be assigned to this listener. Subsequent assignments will replace the previous assignment.
getAnimation(),
hasAnimation()
|
JavaView® v2.12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||