Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 1.93 KB

README.md

File metadata and controls

50 lines (38 loc) · 1.93 KB

AnimatedPaths

Animating the drawing of a CGPath with the help of CAShapeLayer.strokeEnd.

The Objective-C Version is here.

Drawing Rectangle Path:

RCAnimatedPath.shared.drawAnimatedRectanglePath(in: targetView,
                                                           duration: 3,
                                                           lineWidth: 5,
                                                           lineColor: UIColor.red)

Drawing Polygon Path:

RCAnimatedPath.shared.drawAnimatedPolygonPath(in: targetView,
                                                          numberOfSides: 8,
                                                          rotationAngle: 10,
                                                          polygonCornerRadius: 4,
                                                          duration: 3,
                                                          lineWidth: 5,
                                                          lineColor: UIColor.gray)

Drawing Text:

RCAnimatedPath.shared.drawAnimatedText(in: targetView,
                                                   with: "Hello Swift!",
                                                   duration: 3,
                                                   lineWidth: 2,
                                                   textColor: UIColor.blue,
                                                   fontName: "PingFangSC-Bold",
                                                   fontSize: 50)

Drawing Custom Path:

RCAnimatedPath.shared.drawAnimatedCustomPath(in: targetView,
                                                         path: ringPath.cgPath,
                                                         duration: 3,
                                                         lineWidth: 2,
                                                         lineColor: UIColor.black)