SLAnimation Class Reference
Inherits from | CALayer |
---|---|
Declared in | SLAnimation.h SLAnimation.mm |
Overview
Animation type all animation inherit from. Offsers basic playback support.
Warning: Cannot be directly instantiated. Use a subclass instead.
playbackType
Enums to control the playback behavior.
Default:
@property (nonatomic, readwrite) SLPlaybackType playbackType
See Also
Declared In
SLAnimation.h
rate
Determines the rate of playback of the animation. Default: 0.0
@property (nonatomic, readwrite) CGFloat rate
Declared In
SLAnimation.h
time
Time of the animation. Clamped to 0 and animation duration. (0 and 1 in evaluation mode).
@property (nonatomic, readwrite) NSTimeInterval time
Declared In
SLAnimation.h
progress
Playback progression of the animation. Progress = time/animationDuration.
@property (nonatomic, readwrite) CGFloat progress
Declared In
SLAnimation.h
animationInformation
Animation information used to build the animation.
@property (nonatomic, readonly) SLAnimationInformation *animationInformation
See Also
Declared In
SLAnimation.h
animationDuration
Playback duration of the animation.
@property (nonatomic, readonly) NSTimeInterval animationDuration
Declared In
SLAnimation.h
rootLayer
The root layer of the animation.
Corresponds to the main composition layer of your parsed AE composition and will interhit
its size.
Default: rootLayer.masksToBounds = true
@property (nonatomic, readonly) CALayer *rootLayer
Declared In
SLAnimation.h
_Nullable
Block called on specific animation events.
@property (nonatomic, copy) void ( ^ onAnimationEvent ) ( SLAnimationEvent ) _Nullable
See Also
Declared In
SLAnimation.h
– isPaused
Convenience method to test if the animation is currently paused. Equals rate == 0.0.
- (BOOL)isPaused
Return Value
BOOL
Declared In
SLAnimation.h
– playBackwards
Play the animation backwards from its current time. Equals rate = -1.0.
- (void)playBackwards
Declared In
SLAnimation.h
– evaluateExpressions
Squall will evaluate expressions whenever the time of the animation changes. If you make changes to properties referenced in an expression you can call this method to force an evaluation of all expressions attached to any layer properties contained in the animation. For a more performant approach, you can also call the evaluateExpressions methode on the SLLayers whose properties you want to update.
- (void)evaluateExpressions
Declared In
SLAnimation.h
– getLayersWithName:
Returns all the layers with a specific name in your AE composition. Since AE does not enforce unique names it is possible that multiple layers are returned. It is recommended to use unique names in your AE comp if you want to retrieve a specific layer. Internal layers that were replaced with an external layer are elided. Note: The returned layers are also guaranteed to be CALayers.
- (NSArray<id<SLLayerProtocol> > *_Nullable)getLayersWithName:(NSString *_Nonnull)name
Parameters
name |
AE composition layer name |
---|
Return Value
Array containing all the layers matching the input name.
Declared In
SLAnimation.h
– getTextLayerWithName:
Convenience method that returns the first text layer matching the passed-in name. Make sure the AE layer name is unique.
- (SLTextLayer *_Nullable)getTextLayerWithName:(NSString *_Nonnull)name
Parameters
name |
AE composition layer name |
---|
Return Value
First text layer matching the passed-in name or nil.
Declared In
SLAnimation.h
– getShapeLayerWithName:
Convenience method that returns the first SLShapeLayer matching the passed-in name. Make sure the AE layer name is unique.
- (SLShapeLayer *_Nullable)getShapeLayerWithName:(NSString *_Nonnull)name
Parameters
name |
AE composition layer name |
---|
Return Value
First shape layer matching the passed-in name or nil.
Declared In
SLAnimation.h
– getPathLayerWithName:
Convenience method that returns the first SLShapePathLayer of any SLShapeLayer matching the passed-in name. Make sure the AE path name is unique. Alternatively you can also first search for the SLShapePathLayer and then use its getPathLayersWithName method to look for any contained path layers.
- (SLShapePathLayer *_Nullable)getPathLayerWithName:(NSString *_Nonnull)name
Parameters
name |
Path name as used in AE |
---|
Return Value
First path layer matching the passed-in name or nil.
Declared In
SLAnimation.h
– buildWithInformation:
Build an animation with an SLAnimationInformation object output by SLReader. It is usually easier to use one of the convencience methods to build an animation but this gives you the oportunity to tweak some settings before building the animation, e.g. adding an SLCoreAnimationBuildDelegate.
- (void)buildWithInformation:(SLAnimationInformation *_Nonnull)buildInformation
Parameters
buildInformation |
information used to build the animation |
---|
Discussion
SLReader *reader = [[SLReader alloc] init];
NSError* error;
SLAnimationInformation *animationInformation = [reader parseFileFromBundle:@"myAnimation.sqa" error:&error];
if (!error) {
SLSquallAnimation* animation = [[SLSquallAnimation alloc] init];
[animation buildWithInformation:animationInformation];
[self.layer addSublayer:animation];
[animation play];
} else {
NSLog(@"error %@", error);
}
SWIFT
let reader = SLReader()
var animationInformation : SLAnimationInformation?
do {
animationInformation = try reader.parseFileFromBundle("myAnimation.sqa")
} catch {
print("error \(error)")
}
if animationInformation != nil {
let animation = SLSquallAnimation.init()
animation.buildWithInformation(animationInfo)
animation.play()
self.layer.addSublayer(animation)
}
Declared In
SLAnimation.h