Graphics Reference
In-Depth Information
.
position
Use the position property to move a layer's position. The position is dependant
upon the anchorPoint property. If you want to center a layer in its parent view,
leave the anchorPoint at the default of 0.5,0.5 and then calculate the center of the
parent view. Listing 2-3 demonstrates how to center the layer.
LISTING 2-3
Center the Layer in Its Parent View
NSRect parentViewRect = [[window contentView ] frame ];
[layer setPosition :
CGPointMake (parentView. size . width /2.0,
parentView. size . height /2)];
.
zPosition
The zPosition property controls the z -index of the layer. This determines the layer's
position from front to back. It can be animated to transition one layer on top of
another.
Attributes
Each visible characteristic of a layer can also be animated. These are referred to as
attributes because they are the fields that affect the visible attributes of the layer.
Attribute fields that you can animate include
.
borderWidth
The borderWidth property sets the width of the border that surrounds the layer.
.
cornerRadius
The cornerRadius property sets the radius of the corners of the layer giving the
layer a rounded rectangle look.
Visibility
Layer's are visible components, but you can determine how visible. Sometimes, you need
to see through partially or completely. You control this with the visibility fields.
Visibility fields that you can animate include the following:
.
opacity
The opacity property determines the layer's opacity. A value of 1.0 sets the layer to
fully opaque, and a value of 0.0 sets the layer to fully transparent. Use values in
between to set just how opaque you want your layer to be.
.
hidden
In theory, the hidden property is animatable; however, it's actually just an On or
Off switch. If you want to animate the visibility of a layer, use the opacity property
instead of hidden .
 
 
Search WWH ::




Custom Search