HBhvTimeline

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.

Methods

HBhvTimeline::HBhvTimeline(HBhvAnimation *animation = 0)

Constructs an HBhvTimeline object.

Parameters

animation: A pointer to the animation that this timeline is associated with.
virtual HBhvTimeline::~HBhvTimeline() = default

virtual

void HBhvTimeline::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.

void HBhvTimeline::SetAnimation(HBhvAnimation *animation)

Sets the animation that this timeline is associated with.

Parameters

animation: Pointer to Animation
HBhvTimeline *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.
int *HBhvTimeline::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.
int HBhvTimeline::GetTimelineArrayLength()

Returns

The length of the timeline array. This is the number of keyframes in the timeline.
int HBhvTimeline::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 HBhvTimeline::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 HBhvTimeline::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 HBhvTimeline::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 HBhvTimeline::Serialize(HUtilityXMLGenerator *xmlgen)

Write XML Data to buffer

int HBhvTimeline::GetLastTick()

Returns

The last time value of keyframe time array.
int HBhvTimeline::GetFirstTick()

Returns

The first time value of keyframe time array.
bool HBhvTimeline::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.
void HBhvTimeline::SetStartTick(float starttick)

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

Parameters

starttick: Start Tick
float HBhvTimeline::GetStartTick()

Returns

The start time for this time line.
virtual bool HBhvTimeline::Evaluate(float currentTick, int &interval, float &fraction)

virtual

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.
HBhvAnimation *HBhvTimeline::GetAnimation()

Returns

A pointer to the associated animation object.
float HBhvTimeline::GetCurrentTick()

Returns

The current tick for this timeline.
void HBhvTimeline::SetInstancedTimeline(HBhvTimeline *timeline)

Sets the timeline instance.

Parameters

timeline: Instanced Timeline
void HBhvTimeline::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 HBhvTimeline::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.

float HBhvTimeline::GetCurrentRelativeTick()

Returns

Current tick relative to the properties in this timeline. This value takes into account start time and looping.
void HBhvTimeline::SetCurrentRelativeTick(float tick)

Sets current relative time position.

Parameters

tick: Relative Time Position
static void *HBhvTimeline::XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)

static

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

int HBhvTimeline::AddKeyframeInternal(int t, bool *doesExist)

protected

Add keyframe interval to timeline. This method is for internal use.

Parameters

t: Position where to add interval.

doesExist: Returns true if interval already exist or false if interval does not exist.

Returns

Position of the newly inserted interval.
float HBhvTimeline::AdjustTickToTimeline(float tick)

protected

For the given tick, this method returns a tick that has been adjusted to for the timeline. It takes into account factors such as start time and if the animation is looped.

Parameters

tick: The time in ticks to be adjusted.

Returns

The newly adjusted time.

Variables

VArray<int> HBhvTimeline::m_pTimelineArray

protected

VArray< int >

This is for internal use only.

HBhvAnimation *HBhvTimeline::m_pAnimation

protected

This is for internal use only.

HBhvTimeline *HBhvTimeline::m_pInstancedTimeline

protected

This is for internal use only.

float HBhvTimeline::m_StartTick

protected

float

This is for internal use only.

float HBhvTimeline::m_CurrentTick

protected

float

This is for internal use only.

float HBhvTimeline::m_CurrentRelativeTick

protected

float

This is for internal use only.