Interface PsTimeListenerIf
-
- All Known Implementing Classes:
- MathTimerListener, MyProject, PgHarmonicMap, PgSurface_CatenoidHelicoid, PgSurfacePair, PjAvlTree, PjCatenoid, PjClosedPoly, PjComplexFunction, PjConformal, PjConjugate, PjCurvature, PjCurve, PjCycloid, PjDeCasteljau, PjElasticCurve, PjEllipse, PjEventCamera, PjExprOde, PjGeodesic, PjGeodesicFlow, PjHarmonic, PjHeight, PjHelicoid, PjHodge, PjImportModel, PjJuliaSet, PjKeyframe, PjKleinBottle, PjLantern, PjLIC, PjLife, PjLinear, PjLoader, PjLSystem, PjMarchingCubes, PjMaxPrinciple, PjMinesweeper, PjModel, PjParmCurve, PjParmSurface, PjPickEvent, PjPlatonic, PjPointCloud, PjPolygonSet, PjProject, PjPythagoreanTree, PjRivara, PjRootFinder, PjRotation, PjRuler, PjRungeKutta, PjSeeds, PjSizeEdge, PjSizePolygon, PjSizeVertex, PjSlider, PjSmooth, PjSnake, PjSubdivisionCurve, PjSurface, PjSurfCurve, PjTextureCube, PjTexturedSurface, PjTorusKnot, PjTransform, PjTranslation, PjVectorField, PjWeierstrass, PjZigZag, PnExplodePolytope, PsKeyframe, PwEvolve, PwExplode, PwGeodesicFlow, PwSeeds, PwUnfold
public interface PsTimeListenerIfInterface required for all objects who want to register itself in an animation manager.Usage of animations:
- Implement the interface PsTimeListenerIf in a class which shall be animated.
- Create an instance of PsAnimation and register the above dynamic class.
- Show the animationPanel using
anim.getAnimationPanel().setVisible(true)and start animation from panel, or directly callanim.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 interfaceIn DynSample.java: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 listener 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(PsTimeEvent time). anim.setTime(0.);// 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; }- See Also:
PsAnimation,PsKeyframeIf- Author:
- Konrad Polthier
- Version:
- 21.02.01, 3.50 revised (kp) New methods added to access supervising animation.
16.09.00, 3.00 revised (kp) Renamed to PsTimeListenerIf from PsDynamicIf.
02.01.00, 2.20 revised (kp) Methods getTimeOfFirst(),... moved into separate interface PsKeyframeIf.
04.10.99, 2.10 revised (ur) getTimeOfFirst/Previous/Next/LastKey methods added.
12.06.99, 2.00 revised (kp) GetName() method added.
00.00.97, 1.00 created (kp)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description PsAnimationgetAnimation()Get the animation manager where this listener is registered.java.lang.StringgetName()Get name of listener object.booleanhasAnimation()Check whether this object is registered as listener of an animation manager.voidsetAnimation(PsAnimation anAnimation)Assign the animation manager where this listener is registered.booleansetTime(PsTimeEvent timeEvent)Animation updates the dynamic object through this method whenever time has changed.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Get name of listener object. It will e.g. be used as title of the animation panel.
-
setTime
boolean setTime(PsTimeEvent timeEvent)
Animation updates the dynamic object through this method whenever time has changed.
-
getAnimation
PsAnimation getAnimation()
Get the animation manager where this listener is registered. This listener may only have a single animation manager which is assigned by the animation manager when this listener is registered usingsetAnimation(PsAnimation).- See Also:
hasAnimation(),setAnimation(PsAnimation)
-
hasAnimation
boolean hasAnimation()
Check whether this object is registered as listener of an animation manager.- See Also:
getAnimation(),setAnimation(PsAnimation)
-
setAnimation
void setAnimation(PsAnimation anAnimation)
Assign the animation manager where this listener is registered. This method is invoked by the animation manager during registration of this listener, and usually is not required to be called by a user. If this listener has an assigned animation manager, then its animation panel may be shown to change the current time of this listener.Only one animation manager may be assigned to this listener. Subsequent assignments will replace the previous assignment.
- See Also:
getAnimation(),hasAnimation()
-
-
"