SLTextLayer Class Reference

Inherits from SLLayer : CALayer
Declared in SLTextLayer.h
SLTextLayer.mm

Overview

The layer type used by Squall to render and layout text coming from After Effects. You can change attributes of the layer and have the animations adapt accordingly.

Call layoutText after you have made changes to the text layer.

NSError* error;
SLSquallAnimation *animation = [SLSquallAnimation animationFromBundle:@"myAETextAnimation.sqa"
                                                  error:&error];
if (!error) {
    SLTextLayer* testLayer = [animation getTextLayerWithName:@"myAETextLayer"];
    textLayer.text = @"new Text";
    [textLayer layoutText];

    //Prevents the animation to clip the text layer should it
    //now exceed the bounds of the main composition layer.
    animation.rootLayer.masksToBounds = false;

    [animation play];
    [self.view.layer addSublayer:animation];
}
SWIFT
let animation = SLSquallAnimation(fromBundle: "myAETextAnimation.sqa")
let textLayer = animation?.getTextLayerWithName("myAETextLayer")
textLayer?.text = "new Text";
textLayer?.layoutText()

//Prevents the animation to clip the text layer should it
//now exceed the bounds of the main composition layer.
animation?.rootLayer?.masksToBounds = false
animation?.play()
if animation != nil {
    self.view.layer.addSublayer(animation!)
}

  text

String rendered by the layer

@property (nonatomic, strong) NSString *text

Declared In

SLTextLayer.h

  textColor

Text color

@property (nonatomic, strong) UIColor *textColor

Declared In

SLTextLayer.h

  font

Font name used by the text layer.

@property (nonatomic, strong) NSString *font

Declared In

SLTextLayer.h

  fontSize

Font size

@property (nonatomic, readwrite) CGFloat fontSize

Declared In

SLTextLayer.h

  tracking

Tracking

@property (nonatomic, readwrite) CGFloat tracking

Declared In

SLTextLayer.h

  glyphBounds

Bounding boxes of all contained glyphs.

@property (nonatomic, readonly) NSArray<NSValue*> *glyphBounds

Declared In

SLTextLayer.h

– layoutText

Call this method after having made changes to any SLTextLayer properties.

- (void)layoutText

Declared In

SLTextLayer.h

– sizeToFit

Call to size and position the layer to fit the label. Resizes the label to fit the text line. For exact fitting use sizeToFitGlyphBounds

- (void)sizeToFit

Declared In

SLTextLayer.h

– sizeToFitGlyphBounds

Call to size and position the layer to fit the bounds of all contained glyphs;

- (void)sizeToFitGlyphBounds

Declared In

SLTextLayer.h