Re: Ticker tape display
Re: Ticker tape display
- Subject: Re: Ticker tape display
- From: Graham Cox <email@hidden>
- Date: Sun, 31 Jul 2011 14:17:14 +1000
On 31/07/2011, at 1:23 PM, Scott Steinman wrote:
> I have drawn text into a CALayer. I'd like to allow the user select the type of animation effect displayed, such as fading the text in/out by changing the CALayer's opacity.
Do you mean CATextLayer? It's already optimised for displaying text and is really easy to use.
> One of the effects I'm trying to do is a ticker tape display where a line of text is scrolled repeatedly from off-screen on the right side to off-screen on the left side. What would be a good approach for this?
>
> 1. Use a CALayer whose width is that of its containing NSView, with its position animated from off-screen on the right, across the screen, then off-screen to the left? I can't find any documentation that would suggest that a CALayer's starting position can be off-screen past the edges of its containing NSView (with the contents of the CALayer clipped to the edges of the NSView).
This will work. You can simply set the position property to place it within the view. It's OK if it's "off the edge", it will be clipped to the view's frame.
> 3. Use a CALayer that is scrolled by translating in 3D space, or would this preclude using other animation effects, such as fading the text in and out by changing transparency?
This amounts to the same thing. You can either translate the layer's transform, or simply set its position property. All properties such as transparency are independent of each other.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden