Questions tagged [cashapelayer]

CAShapeLayer is a special purpose CALayer subclass for drawing animatable shapes using cubic Bezier splines. It's a part of the QuartzCore framework and is available for both iOS (since iOS 3.0) and OS X (since OS X v10.6 "Snow Leopard").

CAShapeLayer is a special purpose CALayer subclass for drawing animatable shapes using cubic Bezier splines. It's a part of the framework and is available for both (since iOS 3.0) and (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.

951 questions
0
votes
1 answer

CAShapeLayer Line drawing

I am drawing line over 5 custom uiviews (Like UITableView rows) from one position to another (X,Y axis) using CAShapeLayer. My issue is that I want to know that what view the CAShapeLayer (line in my case) is currently in. Is there any CGIntersect…
york
  • 149
  • 1
  • 11
0
votes
1 answer

Set size of UIView based on content size

Is it possible to draw something on a UIView, then, after the drawing is completed, resize the view to be the same size as the thing that was previously drawn? For example, if I draw a circle on a UIView, I would like to crop the UIView to the…
tentmaking
  • 2,076
  • 4
  • 30
  • 53
0
votes
1 answer

How can I set maskToBounds effect on CAShapeLayer(Rounded-Recr cornered UIView)?

I want to make the glow effect spread outside of thisView. I used this code to make Half-Rounded rect cornered UIVew. Round two corners in UIView Here is my code. + (UIView *)makeUpperHalfRoundedView:(UIView *)view { CAShapeLayer *maskLayer =…
Wooseong Kim
  • 1,871
  • 2
  • 21
  • 19
0
votes
1 answer

iphone:How to animate uibeizserpath set stroke color?

I have an one view with horizontal and vertical beizer paths.The resulting view looks like the foloowing Now on touch of the view if user has touched the one of the path,I have to change the color of that path by animation that means on touch of a…
Ajit
  • 47
  • 6
0
votes
1 answer

Animating arbitrarily-shaped CGPath to rectangle

I am using a CAShapeLayer to display a path that is updated as the user traces his/her finger on the screen. I'd like to transform this path to a rectangle that just encloses the path. I can compute the rectangle just fine; the tricky part is…
fumoboy007
  • 5,345
  • 4
  • 32
  • 49
0
votes
1 answer

How do I load an image from the photo roll and add other images from the roll on top of it, possibly sort it, and save the final product?

I'm trying to make some composite images from currently existing ones in the photo rolls. I have code that seems to work that loads an image from the photo roll onto a UIImageView and displays it to the user; (here's the Action that does that:) -…
pikovayadama
  • 808
  • 2
  • 8
  • 26
0
votes
1 answer

I used CGPath to make a picture with 4 CALayers, how can I zoom in and out?

I used CGPath to make a picture with 4 CALayers, how can I zoom in and out? The picture contained a four different circles, a rectangle, and a more complicated shape.However, I want to make it zoom in and out like UIRefreshControl. It's unrealistic…
anna
  • 662
  • 5
  • 28
0
votes
1 answer

how to position a rotating CAShapeLayer at certain point in UIImageView?

I have the following code which makes an oval rotating around its center. I would like to be able to position it within UIImageView at a certain position (say a middle of the view). I would really appreciate if someone could help me out on this…
PrimeSeventyThree
  • 940
  • 2
  • 9
  • 24
0
votes
1 answer

Add a CAShapeLayer between annotation and MKMapView

I'm trying to add an animation below the annotations of my MKMapView but with no luck. I tryed to change the CAShapeLayer zPosition but the circle end up below the map. Here is my current code to add the animation to the map: int radius =…
decomush
  • 156
  • 1
  • 8
0
votes
1 answer

How do I start ios shape animations at different times based on the position of another shape that is already moving

I'm trying to do the following animation for my iPhone App. My current thoughts are to inherit from CAShapeLayer and build up a shape that has the 3 components for the animation. I.e. the yellow rectangle, the green line and the red pointer. I…
whisperstream
  • 1,897
  • 3
  • 20
  • 25
0
votes
0 answers

Retaining property value after CABasicAnimation

Possible Duplicate: Objective-C - CABasicAnimation applying changes after animation? Using the following code, I'm animating the drawing of a circle: CAShapeLayer circle = [CAShapeLayer layer]; circle.strokeEnd = 0; ... [self.view.layer…
Jonathan
  • 13,947
  • 17
  • 94
  • 123
0
votes
1 answer

Changing a circle's size with UIPinchGestureRecognizer

I'm drawing a simple circle in the center of the screen: int radius = 100; - (void)addCircle { self.circle = [CAShapeLayer layer]; self.circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) …
Jonathan
  • 13,947
  • 17
  • 94
  • 123
0
votes
1 answer

CAShapeLayer Dashed Lines While Drawing

I am adding a simple drawing capability to an app and I want the user to be able to draw dashed lines. I have the drawing routine working just fine, adding a CAShapeLayer and setting the path. However, when I try to draw dashed lines the dashes are…
Christopher
  • 5,806
  • 7
  • 31
  • 41
0
votes
1 answer

Using CGPathContainsPoint on CAShapeLayer.path After Moving the Layer

When using CGPathContainsPoint my results are consistent with the original position of the CAShapeLayer but not its current position. Is this normal, and do I need to apply the tranformation on the CGPoint I am testing, or should I be looking for a…
Michael Mangold
  • 1,741
  • 3
  • 18
  • 32
0
votes
2 answers

How to get an UITableView working with CAShapeLayer mask?

I would like to mask an UITableView in a shape of an triangle. My first approach was to setup a CAShapeLayer and add it as a mask directly on the table view. But then, I got the triangle shape scrolling together with the table view. My next approach…
iMarcel
  • 1
  • 2