-
|
I have a very simple UIViewController and I'm trying to present text like the follow code snippet. Yet the print statements output zero bounds. Is it necessary to load a file? Shouldn't I be able to generate a PAGComposition with just a PAGTextLayer? import UIKit
import libpag
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.backgroundColor = .systemBackground
// Setup PAGView
let pagView = PAGView()
pagView.backgroundColor = .systemGray6
pagView.frame = CGRect(x: 0, y: 0, width: view.bounds.width, height: 256)
pagView.center = view.center
// Setup PAGTextLayer
let textLayer = PAGTextLayer()
let font = PAGFont()
font.fontFamily = "ArialMT"
font.fontStyle = "Regular"
textLayer.setFont(font)
textLayer.setFill(.blue)
textLayer.setStroke(.white)
textLayer.setText("My name is Bojan.")
textLayer.setFontSize(32)
// Setup PAGComposition
let composition = PAGComposition()
composition.setContentSize(CGSize(width: view.bounds.width, height: 256))
// Add PAGTextView -> PAGComposition -> PAGView -> UIView
composition.add(textLayer)
pagView.setComposition(composition)
view.addSubview(pagView)
print("composition bounds:", composition.getBounds())
print("textLayer bounds:", textLayer.getBounds())
}
}Xcode: Version 14.3 (14E222b) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
PAGTextLayer does not support external creation and needs to be added by the designer in After Effects. |
Beta Was this translation helpful? Give feedback.
-
|
PAG is primarily designed for rendering animations created in After Effects. It is not recommended to create animations through coding. The PAGComposition APIs enable the combination of multiple PAG files into a single entity, with the primary objective of facilitating seamless animation integration rather than creating animations from scratch. So you can not create a PAGTextLayer. |
Beta Was this translation helpful? Give feedback.
PAG is primarily designed for rendering animations created in After Effects. It is not recommended to create animations through coding. The PAGComposition APIs enable the combination of multiple PAG files into a single entity, with the primary objective of facilitating seamless animation integration rather than creating animations from scratch. So you can not create a PAGTextLayer.