I have a scrollView with paging enabled and a number N of pages, which are UIViews as subviews of the scrollView.
I\'m trying to do the following:
User scrolls t
In Swift 3 (layers is an array of CALayer or CAShapeLayer)
var timeOffset:Double = 0
for layer in layers {
let a = CABasicAnimation(keyPath: "path"
a.fromValue = layer.ovalPathSmall.cgPath
a.toValue = layer.ovalPathLarge.cgPath
a.fillMode = kCAFillModeForwards
a.beginTime = CACurrentMediaTime() + timeOffset
a.duration = 0.3
a.isRemovedOnCompletion = false
layer.add(a, forKey: nil)
timeOffset += 0.3
}
And in case you're wondering what ovalPathSmall and ovalPathLarge are:
ovalPathSmall = UIBezierPath(arcCenter: position, radius: smallRadius, startAngle: 0, endAngle: 2 * .pi, clockwise: true)
ovalPathLarge = UIBezierPath(arcCenter: position, radius: largeRadius, startAngle: 0, endAngle: 2 * .pi, clockwise: true)