HBhvTimeline

Functions

HBhvTimeline

~HBhvTimeline

void

SetTimeline

void

SetAnimation

HBhvTimeline *

CreateInstance

int *

GetTimelineArray

int

GetTimelineArrayLength

int

AddKeyframe

int

AddKeyframe

int

DeleteKeyframe

int

CheckKeyframe

void

Serialize

int

GetLastTick

int

GetFirstTick

bool

GetTimelineInterval

void

SetStartTick

float

GetStartTick

bool

Evaluate

HBhvAnimation *

GetAnimation

float

GetCurrentTick

void

SetInstancedTimeline

void

Adjust

void

AdjustRelative

float

GetCurrentRelativeTick

void

SetCurrentRelativeTick

void *

XMLCallback

Detailed Description

class HBhvTimeline

The HBhvTimeline class encpasulates an animation timeline.

Each animation consists of one timeline and multiple interpolators. The timeline is an array of ascending values measured in ticks with each value representing one keyframe of the animation.

Public Functions

HBhvTimeline(HBhvAnimation *animation = 0)

Constructs an HBhvTimeline object.

Parameters:

animation – A pointer to the animation that this timeline is associated with.

virtual ~HBhvTimeline() = default
void SetTimeline(int const *timeline, int length)

This method replaces a timeline array with array of integer values.

Parameters:
  • timeline – The array of ticks representing the new timeline.

  • length – The number of entries in the passed timeline.

inline void SetAnimation(HBhvAnimation *animation)

Sets the animation that this timeline is associated with.

Parameters:

animation – Pointer to Animation

HBhvTimeline *CreateInstance(HBhvAnimation *animation)

In special cases, you might want to reference this timeline without changing it. To create a new timeline that references this timeline, use this method and pass a pointer to the animation you want associated with the new timeline.

Parameters:

animation – Animation that the created timeline instance should reference

Returns:

The newly created timeline instance.

inline int *GetTimelineArray()
Returns:

The timeline array which contains a list of the keyframe times. Note this is for read-only purposes. If you want to modify the timeline, use the methods provided by this class.

inline int GetTimelineArrayLength()
Returns:

The length of the timeline array. This is the number of keyframes in the timeline.

int AddKeyframe(int t, bool &doesExist)

Adds a new keyframe to the timeline.

Parameters:
  • t – The keyframe time in ticks.

  • doesExist – Pass by reference. Returns true if a keyframe time already exists in the timeline.

Returns:

The number of the newly created keyframe.

int AddKeyframe(int t)

Adds a new keyframe to the timeline.

Parameters:

t – The keyframe time in ticks.

Returns:

The number of the newly created keyframe.

int DeleteKeyframe(int t)

This method deletes the keyframe associated with the given time t from the timeline.

Parameters:

t – Time in ticks of the keyframe to delete.

Returns:

The position of the deleted keyframe or -1 if no keyframe was found and deleted.

int CheckKeyframe(int t)

This method searches for keyframe based the given time.

Parameters:

t – Time in ticks of the keyframe to be searched for.

Returns:

The position of the keyframe associated with the given time or -1 if no keyframe could be found.

void Serialize(HUtilityXMLGenerator *xmlgen)

Write XML Data to buffer

int GetLastTick()
Returns:

The last time value of keyframe time array.

int GetFirstTick()
Returns:

The first time value of keyframe time array.

bool GetTimelineInterval(int currentTick, int &interval)

This method find the keyframe interval that is closet to the current time.

Parameters:
  • currentTick – The time that we are searching for the closest interval.

  • interval – Returns interval that is closet to the current time.

Returns:

True if the currentTick is inside the timeline’s range and false if the currentTick is outside the timeline’s range.

inline void SetStartTick(float starttick)

Set the start time for the timeline. All keyframes are evaluated based on the start time.

Parameters:

starttick – Start Tick

inline float GetStartTick()
Returns:

The start time for this time line.

virtual bool Evaluate(float currentTick, int &interval, float &fraction)

Calculates the keyframe position and fraction value based on the current time.

Parameters:
  • currentTick – Current Time int tps

  • interval – Returns the keyframe interval which was closest to the currentTick.

  • fraction – Returns fraction to next keyframe which will be a value between 0 and 1.

Returns:

True if a valid keyframe interval was found and false if no valid keyframe was found.

inline HBhvAnimation *GetAnimation()
Returns:

A pointer to the associated animation object.

inline float GetCurrentTick()
Returns:

The current tick for this timeline.

inline void SetInstancedTimeline(HBhvTimeline *timeline)

Sets the timeline instance.

Parameters:

timeline – Instanced Timeline

void Adjust(int time, int delta, bool doall = true)

Adjusts the given keyframe time by the passed delta value.

Parameters:
  • time – The time of the keyframe to begin the adjustment.

  • delta – The number of ticks to offset the given time.

  • doall – Pass true ripple the effect to all keyframes after the given time.

void AdjustRelative(int time, int delta)

Adjust Timeline based on delta value relative to current time. In other words, the timeline will be offset by the pass delta value for all the keyframe interval at the given time and all the keyframe intervals after that time.

Parameters:
  • time – The time of the keyframe to begin the adjustment.

  • delta – The number of ticks to offset the given time.

inline float GetCurrentRelativeTick()
Returns:

Current tick relative to the properties in this timeline. This value takes into account start time and looping.

inline void SetCurrentRelativeTick(float tick)

Sets current relative time position.

Parameters:

tick – Relative Time Position

Public Static Functions

static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)

This is XML read callback which parses XML data and then populates the member variables with the associated values.