Class TTimeDependentFunctionality

Unit

Declaration

type TTimeDependentFunctionality = class(TNodeFunctionality)

Description

Functionality of all time-dependent nodes.

Hierarchy

Overview

Fields

Public PartialSend: TPartialSend;

Methods

Public function CycleInterval: TFloatTime;
Public function SetTime(const NewTime: TFloatTime; const TimeIncrease: TFloatTime; const ResetTime: boolean): boolean;

Properties

Public property IsActive: boolean read FIsActive write SetIsActive;
Public property IsPaused: boolean read FIsPaused write SetIsPaused;
Public property ElapsedTime: TFloatTime read FElapsedTime write SetElapsedTime;
Public property ElapsedTimeInCycle: TFloatTime read FElapsedTimeInCycle;

Description

Fields

Public PartialSend: TPartialSend;

Propagate this to all send events, to make animation fade-in/out.

Methods

Public function CycleInterval: TFloatTime;

Final duration (in seconds) of this animation. For a looping animation, this is the time it takes to make a single cycle. Should always be > 0.

The final length, returned here, is

Public function SetTime(const NewTime: TFloatTime; const TimeIncrease: TFloatTime; const ResetTime: boolean): boolean;

Call this when world time increases. This is the most important method of this class, that basically implements time-dependent nodes operations.

NewTime and TimeIncrease are produced by TCastleSceneCore.SetTime and friends.

When ResetTime = true, this means that "TimeIncrease value is unknown" (you must pass TimeIncrease = 0 in this case). This can happen only when were called by ResetTime.

In other circumstances, TimeIncrease must be >= 0. (It's allowed to pass TimeIncrease = 0 and ResetTime = false, this doesn't advance the clock, but is a useful trick to force some update, see HandleChangeTimeStopStart in TCastleSceneCore.InternalChangedField implementation.)

References: see X3D specification "Time" component, 8.2 ("concepts") for logic behind all those start/stop/pause/resumeTime, cycleInterval, loop properties.

Returns

If some state of time-dependent node changed.

Properties

Public property IsActive: boolean read FIsActive write SetIsActive;

Is the sensor enabled and running (ignoring whether it is paused).

For a precise specification of how this behaves, see the X3D TimeSensor.isActive specification at http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/time.html#TimeSensor

Changing this automatically causes appropriate events to be generated.

Public property IsPaused: boolean read FIsPaused write SetIsPaused;

Is the sensor paused.

For a precise specification of how this behaves, see the X3D TimeSensor.isPaused specification at http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/time.html#TimeSensor

Changing this automatically causes appropriate events to be generated.

Public property ElapsedTime: TFloatTime read FElapsedTime write SetElapsedTime;

Time in seconds since the sensor was activated and running, not counting any time while in pause state.

For non-looping animations, note that the sensor automatically stops when the animation finishes, so ElapsedTime will not grow beyond the CycleInterval. If you want to observe when the animation ended, you probably do not want to use this property. Instead observe when IsActive changed to False, by registering a callback on EventIsActive.AddNotification. See the CGE examples/viewport_and_scenes/listen_on_x3d_events/ . Or, even better (simpler and more reliable) register a stop notification using TPlayAnimationParameters.StopNotification with TCastleSceneCore.PlayAnimation.

For a precise specification of how this behaves, see the X3D TimeSensor.elapsedTime specification at http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/time.html#TimeSensor

Changing this automatically causes appropriate events to be generated.

Public property ElapsedTimeInCycle: TFloatTime read FElapsedTimeInCycle;

Time in seconds since the sensor was activated and running, in this cycle, not counting any time while in pause state.

This is like ElapsedTime, but counting only the current cycle. When CycleInterval = 0, this is always 0. When CycleInterval <> 0, this is always >= 0 and < CycleInterval .


Generated by PasDoc 0.16.0-snapshot.