Inherits from NSObject
Conforms to NGLCoreTimer
Declared in NGLTween.h

Overview

NGLTween is responsible for creating and managing interpolations to scalar properties during a time.

The tweens can have ease In and/or Out interpolations. The tweens are created with an instance of NGLTween, you can choose to hold it or not. Even if you choose don’t retain its instance, you are able to retrieve it later based on its name or target.

The tween can be paused and resumed by using the paused property, you can also cancel the tween with #cancelTween# or restart it by calling the restartTween method.

The NGLTween works with the delegate concept. You can define a delegate class to receive messages from events of your tween, like “will start”, “will repeat”, “did finish” and others.

NGLTween is a sophisticated way to deal with animations because it makes use of NGLTimer, the unique optimized timer of NinevehGL. You can even define infinity animations with NGLTween.

To initialize a tween you must use tweenWithTarget:duration:values: or initWithTarget:duration:values: methods. The single init has no effect. The tween will start on the next render cycle, respecting the current NinevehGL Global FPS.

Tasks

Properties

delegate

The delegate must conform to NGLTweenDelegate protocol.

@property (nonatomic, assign) id<> delegate

Discussion

The delegate must conform to NGLTweenDelegate protocol.

See Also

Declared In

NGLTween.h

name

The name is an identifier.

@property (nonatomic, readonly) NSString *name

Discussion

The name is an identifier.

You can use the name to retrieve a NGLTween instance later. This property can’t be changed and must be defined when you construct the tween.

Declared In

NGLTween.h

paused

Pauses or resumes the animation. When set to YES, it pauses immediatly the tween.

@property (nonatomic) BOOL paused

Discussion

Pauses or resumes the animation. When set to YES, it pauses immediatly the tween.

There is no limit of time for a paused tween, it will keep paused until you set this property to NO again, which will resume the tween.

When you resume, the tween continues from the same point it was paused.

Declared In

NGLTween.h

target

The target of the tween.

@property (nonatomic, readonly) id target

Discussion

The target of the tween.

The changes will happen on this object. This property can’t be changed and must be defined when you construct the tween.

Declared In

NGLTween.h

Class Methods

stopAllTweens:

Acts as stopTween: method, but working for all the current tweens. The tweens will receive a #finishTween# message.

+ (void)stopAllTweens:(NGLTweenStop)option

Parameters

option

The type of the stopping. The tween can stop at the very current moment with the current state or stop with the initial state. The finished states is about the final state of the current loop cycle.

Discussion

Acts as stopTween: method, but working for all the current tweens. The tweens will receive a #finishTween# message.

Declared In

NGLTween.h

stopAllTweens:forTarget:

Acts as stopTween: method, but working for all tweens of a specific target. The tweens will receive a #finishTween# message.

+ (void)stopAllTweens:(NGLTweenStop)option forTarget:(id)target

Parameters

option

The type of the stopping. The tween can stop at the very current moment with the current state or stop with the initial state. The finished states is about the final state of the current loop cycle.

target

The target wich has tweens you want to remove.

Discussion

Acts as stopTween: method, but working for all tweens of a specific target. The tweens will receive a #finishTween# message.

Declared In

NGLTween.h

tweenForName:

Returns a NGLTween instance with the informed name.

+ (NGLTween *)tweenForName:(NSString *)name

Parameters

name

The name of the tween you are looking for.

Return Value

The related NGLTween instance or nil if not found.

Discussion

Returns a NGLTween instance with the informed name.

If more than one NGLTween was found, only the first match will be returned.

Declared In

NGLTween.h

tweenForTarget:

Returns a NGLTween instance with the informed target.

+ (NGLTween *)tweenForTarget:(id)target

Parameters

target

The target of the tween you are looking for.

Return Value

The related NGLTween instance or nil if not found.

Discussion

Returns a NGLTween instance with the informed target.

If more than one NGLTween was found, only the first match will be returned.

Declared In

NGLTween.h

tweenWithTarget:duration:values:

Initializes a NGLTween instance with a target, duration and settings.

+ (id)tweenWithTarget:(id)target duration:(float)seconds values:(NSDictionary *)dictionary

Parameters

target

The target of the tween. Only the scalar properties can be tweened.

seconds

The duration of the tween in seconds.

dictionary

A NSDictionary containing the list of settings to this tween.

Return Value

A new autoreleased instance.

Discussion

Initializes a NGLTween instance with a target, duration and settings.

Declared In

NGLTween.h

Instance Methods

initWithTarget:duration:values:

Initializes a NGLTween instance with a target, duration and settings.

- (id)initWithTarget:(id)target duration:(float)seconds values:(NSDictionary *)dictionary

Parameters

target

The target of the tween. Only the scalar properties can be tweened.

seconds

The duration of the tween in seconds.

dictionary

A NSDictionary containing the list of settings to this tween.

Return Value

A new initialized instance.

Discussion

Initializes a NGLTween instance with a target, duration and settings.

Declared In

NGLTween.h

restartTween

Restarts the tween from the beginig.

- (void)restartTween

Discussion

Restarts the tween from the beginig.

This method restart the whole tween, even it has a repetition, everything will restart.

Declared In

NGLTween.h

stopTween:

Stops the tween immediately.

- (void)stopTween:(NGLTweenStop)option

Parameters

option

The type of the stopping. The tween can stop at the very current moment with the current state or stop with the initial state. The finished states is about the final state of the current loop cycle.

Discussion

Stops the tween immediately.

You can choose if the tween will stop in the current state or if it’ll go to the end, assuming the final state. If the tween is in a loop, the final state is the end of the current loop cycle.

Declared In

NGLTween.h