I want to have text inside of a CAScrollLayer scroll by itself from starting point to ending point and then reset the animation. However I cannot seem to get a CATextLayer i
One hardly needs or wants a CAScrollLayer or a CATextLayer for this. Simply start with a superview that clips to its bounds, and inside that put a UILabel. Animate the sideways movement of the label and you're done.
Here's a rough sketch:
let w1 = self.lab.frame.width
let w2 = self.lab.superview!.frame.width
let w = w1 - w2
let x = self.lab.frame.origin.x
UIView.animateWithDuration(5, delay: 0, options: .CurveLinear, animations: {
self.lab.frame.origin.x -= w
}, completion: {
_ in
self.lab.frame.origin.x = x
})