SLCoreAnimationBuildDelegate Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | SLCoreAnimation.h |
Overview
Delegate protocol to control how and if animations are added to a layer.
SLReader *reader = [[SLReader alloc] init];
NSError* error;
[reader parseFileFromBundle:@"myAnimation.sqa" error:&error];
if (!error) {
SLCoreAnimation* animation = [[SLCoreAnimation alloc] init];
animation.buildDelegate = self; //self needs to implement <SLCoreAnimationBuildDelegate>
[animation buildWithInformation:reader.buildInformation];
[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.delegate = self
animation.buildWithInformation(animationInfo)
animation.play()
self.layer.addSublayer(animation)
}
– shouldAddAnimations:toLayer:withName:
required method
Implement it to control when and if an animation should be added to a SLCoreAnimation.
- (CAAnimationGroup *_Nullable)shouldAddAnimations:(CAAnimationGroup *_Nonnull)group toLayer:(CALayer *_Nonnull)layer withName:(NSString *_Nonnull)name
Parameters
group |
Animation group containing all animations that Squall wants to add the to the layer. |
---|---|
layer |
CALayer the animation will be added to |
name |
Name of the AE composition layer |
Return Value
Return a modified or unmodified animation or nil to prevent the animation group from being added.
Discussion
Warning: Names do not necessarily directly correspond to the AVLayers from After Effects
Declared In
SLCoreAnimation.h