39 typedef std::shared_ptr<class Cue>
CueRef;
48 void step(
float timestep );
50 void stepTo(
float absoluteTime );
60 return applyPtr( target->
ptr(), endValue, duration, easeFunction, lerpFunction );
68 return applyPtr( target->
ptr(), startValue, endValue, duration, easeFunction, lerpFunction );
76 return appendToPtr( target->
ptr(), endValue, duration, easeFunction, lerpFunction );
84 return appendToPtr( target->
ptr(), startValue, endValue, duration, easeFunction, lerpFunction );
130 CueRef add(
const std::function<
void ()> &action,
float atTime );
178 void reset(
bool unsetStarted =
false );
207 virtual void update(
float absTime );
216 std::multimap<void*,TimelineItemRef>
mItems;
225 Cue(
const std::function<
void ()> &fn,
float atTime = 0 );
239 virtual void update(
float relativeTime ) {}
Timeline()
Definition: Timeline.cpp:38
std::function< T(const T &, const T &, float)> LerpFn
Definition: Tween.h:157
static TimelineRef create()
Creates a new timeline, defaulted to infinite.
Definition: Timeline.h:45
void insert(TimelineItemRef item)
adds an item to the timeline. Its start time is not modified. Safe to use from callback fn's...
Definition: Timeline.cpp:124
TimelineRef thisRef()
Definition: Timeline.h:188
TimelineItemRef thisRef()
Definition: TimelineItem.h:104
TimelineItemRef find(void *target) const
Returns the first item in the timeline the target of which matches target.
Definition: Timeline.cpp:159
virtual float calcDuration() const
Definition: Timeline.cpp:149
virtual TimelineItemRef cloneReverse() const
Creates a cloned item which runs in reverse relative to a timeline of duration timelineDuration.
Definition: Timeline.cpp:314
float getCurrentTime() const
Returns the timeline's most recent current time.
Definition: Timeline.h:53
int int * max
Definition: GLee.h:17208
void appendPingPong()
Appends to the end of the timeline mirror images of all items.
Definition: Timeline.cpp:91
Cue(const std::function< void()> &fn, float atTime=0)
Definition: Timeline.cpp:337
bool mDefaultAutoRemove
Definition: Timeline.h:213
virtual void reverse()
Definition: Timeline.h:233
virtual void update(float absTime)
Definition: Timeline.cpp:324
void step(float timestep)
Advances time a specified amount and evaluates items.
Definition: Timeline.cpp:52
Tween< T >::Options apply(Anim< T > *target, T startValue, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Replaces any existing tweens on the target with a new tween at the timeline's current time...
Definition: Timeline.h:65
TimelineItemRef findLastEnd(void *target) const
Returns the latest-end item in the timeline the target of which matches target.
Definition: Timeline.cpp:186
void reset(bool unsetStarted=false)
Sets the time to zero, marks all tweens as not completed, and if unsetStarted, marks the tweens as no...
Definition: Timeline.cpp:289
std::function< void()> mFunction
Definition: Timeline.h:243
std::shared_ptr< class Timeline > TimelineRef
Definition: Timeline.h:40
void insert(TimelineItemRef item, float atTime)
adds an item to the timeline, setting its startTime to be at atTime. Safe to use from callback fn's...
Definition: Timeline.h:152
Tween< T >::Options apply(Anim< T > *target, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Replaces any existing tweens on the target with a new tween at the timeline's current time...
Definition: Timeline.h:57
Tween< T >::Options appendToPtr(T *target, T startValue, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Creates a new tween and adds it to the end of the last tween on target, or if no existing tween match...
Definition: Timeline.h:120
GLenum target
Definition: GLee.h:13607
void clear()
Remove all tweens from the Timeline. Do not call from callback fn's.
Definition: Timeline.cpp:86
Tween< T >::Options appendTo(Anim< T > *target, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Creates a new tween and adds it to the end of the last tween on target, or if no existing tween match...
Definition: Timeline.h:73
float mCurrentTime
Definition: Timeline.h:214
void stepTo(float absoluteTime)
Goes to a specific time and evaluates items.
Definition: Timeline.cpp:58
virtual void start(bool reverse)
Definition: Timeline.h:237
virtual void update(float relativeTime)
Definition: Timeline.h:239
size_t getNumItems() const
Returns the number of items in the Timeline.
Definition: Timeline.h:155
virtual TimelineItemRef clone() const
Creates a clone of the item.
Definition: Timeline.cpp:348
CueRef add(const std::function< void()> &action, float atTime)
add a cue to the Timeline add the start-time atTime
Definition: Timeline.cpp:78
Tween< T >::Options applyPtr(T *target, T startValue, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Replaces any existing tweens on the target with a new tween at the timeline's current time...
Definition: Timeline.h:99
virtual TimelineItemRef cloneReverse() const
Creates a cloned item which runs in reverse relative to a timeline of duration timelineDuration.
Definition: Timeline.cpp:353
virtual void loopStart()
Definition: Timeline.cpp:342
std::multimap< void *, TimelineItemRef > mItems
Definition: Timeline.h:216
void itemTimeChanged(TimelineItem *item)
Call this to notify the Timeline if the item's start-time or duration has changed. Advanced use cases only.
Definition: Timeline.cpp:330
Tween< T >::Options applyPtr(T *target, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Replaces any existing tweens on the target with a new tween at the timeline's current time...
Definition: Timeline.h:89
Base interface for anything that can go on a Timeline.
Definition: TimelineItem.h:34
virtual void start(bool reverse)
Definition: Timeline.h:205
bool getDefaultAutoRemove() const
Returns the default autoRemove value for all future TimelineItems added to the Timeline.
Definition: Timeline.h:183
void eraseMarked()
Definition: Timeline.cpp:132
Definition: Timeline.h:223
float easeNone(float t)
Easing equation for a simple linear tweening with no easing.
Definition: Easing.h:49
CueRef create(const std::function< void()> &fn, float atTime=0)
Definition: Timeline.h:227
Tween< T >::Options appendTo(Anim< T > *target, T startValue, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Creates a new tween and adds it to the end of the last tween on target, or if no existing tween match...
Definition: Timeline.h:81
void setParentTimeline(TimelineRef parentTimeline)
Definition: Tween.cpp:109
bool empty() const
Returns true if there are no items in the Timeline.
Definition: Timeline.h:157
virtual void reverse()
Definition: Timeline.cpp:303
const T * ptr() const
Definition: Tween.h:369
void setDefaultAutoRemove(bool defaultAutoRemove)
Sets the default autoRemove value for all future TimelineItems added to the Timeline.
Definition: Timeline.h:181
float findEndTimeOf(void *target, bool *found=NULL) const
Returns the end of the latest-ending item in the timeline the target of which matches target...
Definition: Timeline.cpp:206
void replaceTarget(void *target, void *replacementTarget)
Replaces the target of all TimelineItems whose target matches target, with replacementTarget.
Definition: Timeline.cpp:274
std::function< void()> getFn() const
Definition: Timeline.h:230
void removeTarget(void *target)
Removes all TimelineItems whose target matches target.
Definition: Timeline.cpp:242
FnTweenRef< T > applyFn(const std::function< void(T)> &fn, T startValue, T endValue, float duration, const EaseFn &easeFunction=easeNone, const typename Tween< T >::LerpFn &lerpFunction=&tweenLerp< T >)
Definition: Timeline.h:133
std::shared_ptr< class TimelineItem > TimelineItemRef
Definition: TimelineItem.h:31
virtual void complete(bool reverse)
Definition: Timeline.h:240
void cloneAndReplaceTarget(void *target, void *replacementTarget)
Clones all TimelineItems whose target matches target, but replacing their target with replacementTarg...
Definition: Timeline.cpp:254
std::shared_ptr< class Cue > CueRef
Definition: Timeline.h:39
virtual void complete(bool reverse)
Definition: Timeline.h:208
virtual TimelineItemRef clone() const
Creates a clone of the item.
Definition: Timeline.cpp:309
std::function< float(float)> EaseFn
Definition: Tween.h:42
TimelineItemRef findLast(void *target) const
Returns the latest-starting item in the timeline the target of which matches target.
Definition: Timeline.cpp:171
Tween< T >::Options appendToPtr(T *target, T endValue, float duration, EaseFn easeFunction=easeNone, typename Tween< T >::LerpFn lerpFunction=&tweenLerp< T >)
Creates a new tween and adds it to the end of the last tween on target, or if no existing tween match...
Definition: Timeline.h:109
Definition: Timeline.h:42
void setFn(const std::function< void()> &fn)
Definition: Timeline.h:229
virtual void loopStart()
Definition: Timeline.cpp:298
virtual bool updateAtLoopStart()
Call update() only at the beginning of each loop (for example Cues exhibit require this behavior) ...
Definition: Timeline.h:241