Re: [CA] Create a "A la FrontRow" Button
Re: [CA] Create a "A la FrontRow" Button
- Subject: Re: [CA] Create a "A la FrontRow" Button
- From: Scott Anguish <email@hidden>
- Date: Thu, 6 Dec 2007 02:09:41 -0500
On Dec 5, 2007, at 6:01 PM, Paul Arthur Henrion wrote:
Hi there,
first of all, I'm sorry for my double mailing: I did not know which
list was more appropriate for this question, because it's about
CoreAnimation, so it's Cocoa related and also Quartz(Core) related.
By the way, here is what I want to do: create a "à la FrontRow"
button (the highlighting rectangle below the current selection).
In order to do so I thought I'd create a CALayer subclass which
would contain two gradients -- one for the button top, the other for
the bottom -- to create a gloss effect and a outline light. I
thought I could use CIFilters to create these
"effects" (CILinearGradient and CIBloom), but it isn't that easy
(well, I think I just don't use them correctly): the two
CILinearGradient I create are applied on the layer as
"backgroundFilters" (if they are applied as -- foreground --
"filters" they don't appear) and the CIBloom, as a -- foreground --
"filters" (and doesn't appear).
I think that if my filters don't appear when they're applied as
foreground filters it's because my layer is empty -- which is
logical :'). So do I have to provide a "fake" contents to my layer
(as a transparent 1 square pixel picture streched to my layer
bounds)? Or is there a smarter way to create my "à la FrontRow"
button layer?
The walkthough at the end of the Core Animation Programming Guide
implements a menu just like this.
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Headstart.html#/
/apple_ref/doc/uid/TP40006131
The text layers are in one layer and the selection indicating layer is
on another.
The bloom is draw on the outside of the button
the example has no gradient though, if you want the gradient on the
inside you would simply set the content of the selection indication
layer to the appropriate graphic that shows the gradient.. but be sure
that the gradient graphic has the appropriate alpha levels.
no need for filters at all, just proper layering of the layers.
Anyone who was at WWDC can send you the source for the Core Animation
Menu example (which is this example) so you can play with it
directly. Otherwise you can get an idea of its structure and output
from the article itself.
_______________________________________________
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