Описание тега cashapelayer
CAShapeLayer
is a special purpose CALayer
subclass for drawing animatable shapes using cubic Bezier splines. It's a part of the quartz-core framework and is available for both ios (since iOS 3.0) and osx (since OS X v10.6 "Snow Leopard").
The shapes is defined using the path
property and can be both filled and stroked using the fillColor
and strokeColor
properties. Note that the backgroundColor
property inherited from CALayer
does not fill the shape. The path of the shape is animatable (but doesn't support implicit animations) but the appearance of the animation is undefined if the two paths have a different number of control points or segments.
There are several properties (animatable) to configure how the shape is stroked and filled. Using these properties the stroke can for example get a moving dashed patten (commonly called "marching ants").
The strokeStart
and strokeEnd
properties can also be used to only stroke part of the shape or to animate the shape being stroked. Both values go from 0.0 (beginning of path) to 1.0 (end of path) and values in between are interpolated along the path.
The page about Paths in the Quartz 2D Programming Guide is a great resource for learning more about creating paths, stroking, rounding and joining paths, filling paths and creating dash patterns.