PG_EventAnimate Structure

Description

This structure holds data passed to event handlers for animation events: #PG_Event_Animate and #PG_Event_AnimateSkin. It provides information about the animation's state, timing, and the associated object's dimensions.

Structure Definition

Structure PG_EventAnimate
  id.i ; The ID assigned to the animation when started (or #PG_Any if not specified)

  state.i ; The current phase of the animation (#PG_Event_Animate_Start, #PG_Event_Animate_Update, #PG_Event_Animate_End)
  duration.i ; The total duration of the animation in milliseconds
  deltaTime.i ; The time elapsed in milliseconds since the last animation update event for this animation
  currentTime.i ; The total time elapsed in milliseconds since the animation started

  width.d ; Current width of the associated object (Window or Widget) in DIPs
  height.d ; Current height of the associated object (Window or Widget) in DIPs

  *userData ; The user data pointer passed when the animation was started
EndStructure

Members

id.i
The identifier for this specific animation instance, as returned by StartAnimation() or assigned internally.

state.i
Indicates the current stage of the animation lifecycle. Can be one of:

  • #PG_Event_Animate_Start: The first frame of the animation.
  • #PG_Event_Animate_Update: An intermediate frame during the animation.
  • #PG_Event_Animate_End: The final frame of the animation (or when it was stopped).

duration.i
The total intended length of the animation in milliseconds, as specified in StartAnimation().

deltaTime.i
The time, in milliseconds, that has passed since the previous #PG_Event_Animate_Update for this animation. Useful for frame-rate independent calculations.

currentTime.i
The total elapsed time, in milliseconds, from the start of the animation until the current frame. This value is used as the 't' parameter in transition functions. It will not exceed `duration`.

width.d
The current width of the animating object (Window or Widget) in DIPs at the time the event was generated.

height.d
The current height of the animating object (Window or Widget) in DIPs at the time the event was generated.

*userData
The custom data pointer that was optionally provided when calling StartAnimation().

Used By Events

Remarks

This structure is essential for implementing custom animation logic within event handlers. The `state` member allows for initialization and cleanup code, while `currentTime` and `duration` are used with transition functions (like Transition_Linear(), Transition_EaseInOut(), etc.) to calculate intermediate values for animated properties.

See Also

AddEventHandler, StartAnimation, StopAnimation, AnimationGetCurrentTime, Event Handling Overview, Animation & Transitions Overview

Supported OS

Windows, Linux