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)
}