Crazy Eddie's GUI System  0.8.6
CEGUI::KeyFrame Class Reference

Defines a 'key frame' class. More...

+ Inheritance diagram for CEGUI::KeyFrame:
+ Collaboration diagram for CEGUI::KeyFrame:

Public Types

enum  Progression { P_Linear, P_QuadraticAccelerating, P_QuadraticDecelerating, P_Discrete }
 

Public Member Functions

 KeyFrame (Affector *parent, float position)
 internal constructor, please use Affector::createKeyFrame
 
 ~KeyFrame (void)
 internal destructor, please use Affector::destroyKeyFrame
 
AffectorgetParent () const
 Retrieves parent Affector of this Key Frame.
 
size_t getIdxInParent () const
 Retrieves index with which this keyframe is retrievable in parent Affector. More...
 
void moveToPosition (float newPosition)
 Moves this keyframe to a new given position.
 
float getPosition () const
 Retrieves position of this key frame in the animation (in seconds)
 
void setValue (const String &value)
 Sets the value of this key frame. More...
 
const StringgetValue () const
 Retrieves value of this key frame.
 
void setSourceProperty (const String &sourceProperty)
 Sets the source property of this key frame. More...
 
const StringgetSourceProperty () const
 Gets the source property of this key frame.
 
const StringgetValueForAnimation (AnimationInstance *instance) const
 Retrieves value of this for use when animating. More...
 
void setProgression (Progression p)
 Sets the progression method of this key frame. More...
 
Progression getProgression () const
 Retrieves progression method of this key frame.
 
float alterInterpolationPosition (float position)
 Internal method, alters interpolation position based on progression method. Don't use unless you know what you're doing!
 
void savePropertyValue (AnimationInstance *instance)
 Internal method, if this keyframe is using source property, this saves it's value to given instance before it's affected.
 
void notifyPositionChanged (float newPosition)
 internal method, notifies this keyframe that it has been moved More...
 
void writeXMLToStream (XMLSerializer &xml_stream) const
 Writes an xml representation of this KeyFrame to out_stream. More...
 

Detailed Description

Defines a 'key frame' class.

Key frames are defined inside Affectors. The values they hold are used when animation is precisely at the key frame's position. If it's between two key frames, the value is interpolated.

See also
Affector

Member Enumeration Documentation

enumerates possible progression methods, IE how the value progresses TOWARS this key frames, this means that progression method of the first key frame won't be used for anything!

Enumerator
P_Linear 

linear progression

P_QuadraticAccelerating 

progress is accelerated, starts slow and speeds up

P_QuadraticDecelerating 

progress is decelerated, starts fast and slows down

P_Discrete 

left neighbour's value is picked if interpolation position is lower than 1.0, right is only picked when interpolation position is exactly 1.0

Member Function Documentation

size_t CEGUI::KeyFrame::getIdxInParent ( ) const

Retrieves index with which this keyframe is retrievable in parent Affector.

Note
The index is only valid as long as the list of affectors is unchanged in animation!
const String& CEGUI::KeyFrame::getValueForAnimation ( AnimationInstance instance) const

Retrieves value of this for use when animating.

This is an internal method! Only use if you know what you're doing!
This returns the base property value if source property is set on this keyframe, it works the same as getValue() if source property is empty
void CEGUI::KeyFrame::notifyPositionChanged ( float  newPosition)

internal method, notifies this keyframe that it has been moved

DO NOT CALL DIRECTLY, should only be used by Affector class
See also
KeyFrame::moveToPosition
void CEGUI::KeyFrame::setProgression ( Progression  p)

Sets the progression method of this key frame.

This controls how the animation will progress TOWARDS this key frame, whether it will be a linear motion, accelerated, decelerated, etc...

That means that the progression of the first key frame is never used!

Please see KeyFrame::Progression

void CEGUI::KeyFrame::setSourceProperty ( const String sourceProperty)

Sets the source property of this key frame.

Key frame can get it's value from 2 places, it's either stored inside it (setValue, getValue methods) or it's linked to a property (setSourcePropery, getSourceProperty).

The decision about what value is used is simple, if there is a source property (sourceProperty is not empty, it's used)

void CEGUI::KeyFrame::setValue ( const String value)

Sets the value of this key frame.

This is only used if source property is empty!
See also
KeyFrame::setSourceProperty
void CEGUI::KeyFrame::writeXMLToStream ( XMLSerializer xml_stream) const

Writes an xml representation of this KeyFrame to out_stream.

Parameters
xml_streamStream where xml data should be output.