Package com.jme3.cinematic.events
Class AnimEvent
java.lang.Object
com.jme3.cinematic.events.AbstractCinematicEvent
com.jme3.cinematic.events.AnimEvent
- All Implemented Interfaces:
CinematicEvent
,Savable
A CinematicEvent that plays a canned animation action in an
AnimComposer
.
Inspired by Nehon's AnimationEvent
.-
Field Summary
Fields inherited from class com.jme3.cinematic.events.AbstractCinematicEvent
initialDuration, listeners, loopMode, playState, resuming, speed, time
-
Constructor Summary
ModifierConstructorDescriptionprotected
No-argument constructor needed by SavableClassUtil.AnimEvent
(AnimComposer composer, String actionName, String layerName) Instantiate a non-looping event to play the named action on the named layer of the specified AnimComposer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
initEvent
(Application app, Cinematic cinematic) Initialize this event.void
onPause()
Callback when the event is paused.void
onPlay()
Callback when the event is started.void
onStop()
Callback when the event is stopped.void
onUpdate
(float tpf) Callback on each render pass while the event is playing.void
read
(JmeImporter importer) De-serialize this event from the specified importer, for example when loading from a J3O file.void
setSpeed
(float speed) Alter the speed of the animation.void
setTime
(float time) Jump to the specified time.void
write
(JmeExporter exporter) Serialize this event to the specified exporter, for example when saving to a J3O file.Methods inherited from class com.jme3.cinematic.events.AbstractCinematicEvent
addListener, dispose, forceStop, getDuration, getInitialDuration, getLoopMode, getPlayState, getSpeed, getTime, internalUpdate, pause, play, removeListener, setInitialDuration, setLoopMode, stop
-
Field Details
-
logger
-
-
Constructor Details
-
AnimEvent
Instantiate a non-looping event to play the named action on the named layer of the specified AnimComposer.- Parameters:
composer
- the Control that will play the animation (not null)actionName
- the name of the animation action to be playedlayerName
- the name of the animation layer on which the action will be played
-
AnimEvent
protected AnimEvent()No-argument constructor needed by SavableClassUtil.
-
-
Method Details
-
initEvent
Initialize this event. (for internal use)- Specified by:
initEvent
in interfaceCinematicEvent
- Overrides:
initEvent
in classAbstractCinematicEvent
- Parameters:
app
- the Application that contains this eventcinematic
- the Cinematic that contains this event
-
onPause
public void onPause()Callback when the event is paused.- Specified by:
onPause
in classAbstractCinematicEvent
-
onPlay
public void onPlay()Callback when the event is started.- Specified by:
onPlay
in classAbstractCinematicEvent
-
onStop
public void onStop()Callback when the event is stopped.- Specified by:
onStop
in classAbstractCinematicEvent
-
onUpdate
public void onUpdate(float tpf) Callback on each render pass while the event is playing.- Specified by:
onUpdate
in classAbstractCinematicEvent
- Parameters:
tpf
- time per frame (in seconds)
-
read
De-serialize this event from the specified importer, for example when loading from a J3O file.- Specified by:
read
in interfaceSavable
- Overrides:
read
in classAbstractCinematicEvent
- Parameters:
importer
- (not null)- Throws:
IOException
- from the importer
-
setSpeed
public void setSpeed(float speed) Alter the speed of the animation.- Specified by:
setSpeed
in interfaceCinematicEvent
- Overrides:
setSpeed
in classAbstractCinematicEvent
- Parameters:
speed
- the relative speed (default=1)
-
setTime
public void setTime(float time) Jump to the specified time.- Specified by:
setTime
in interfaceCinematicEvent
- Overrides:
setTime
in classAbstractCinematicEvent
- Parameters:
time
- the desired time (in seconds, time=0 is the start of the event)
-
write
Serialize this event to the specified exporter, for example when saving to a J3O file.- Specified by:
write
in interfaceSavable
- Overrides:
write
in classAbstractCinematicEvent
- Parameters:
exporter
- (not null)- Throws:
IOException
- from the exporter
-