Ios UIBezierPath:设置透明圆的动画并移动透明圆

Ios UIBezierPath:设置透明圆的动画并移动透明圆,ios,iphone,animation,uibezierpath,Ios,Iphone,Animation,Uibezierpath,我正在尝试创建一个内部有透明孔的覆盖层。 当叠加显示时,圆圈应该反弹一点,然后移动到视图底部 我创建了一个圆,并尝试添加动画和运动,但什么都没有发生,圆没有移动 这是我的代码: let overlay = UIView(frame: (self.view?.bounds)!) let radius: CGFloat = 60.0 let circleFrame = CGRect(x: (self.view?.bounds.size.width)!/2, y: (self.view?.bounds

我正在尝试创建一个内部有透明孔的覆盖层。 当叠加显示时,圆圈应该反弹一点,然后移动到视图底部

我创建了一个圆,并尝试添加动画和运动,但什么都没有发生,圆没有移动

这是我的代码:

let overlay = UIView(frame: (self.view?.bounds)!)
let radius: CGFloat = 60.0
let circleFrame = CGRect(x: (self.view?.bounds.size.width)!/2, y: (self.view?.bounds.size.height)!/2, width: radius, height: radius)
let path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: (self.view?.bounds.size.width)!, height: (self.view?.bounds.size.height)!), cornerRadius: 0)
let circlePath = UIBezierPath(roundedRect: circleFrame, cornerRadius: radius)
path.append(circlePath)
path.usesEvenOddFillRule = true

let fillLayer = CAShapeLayer()
fillLayer.path = path.cgPath
fillLayer.fillRule = kCAFillRuleEvenOdd
fillLayer.fillColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 0.7).cgColor
overlay.layer.addSublayer(fillLayer)
self.view?.addSubview(overlay)
circlePath.apply(CGAffineTransform(translationX: 50, y: 50))
circlePath.stroke()

有人能帮忙吗?谢谢。

你为什么要翻译路径10000点?注释已编辑。你如何设置圆的动画?我可以建议顶部的
guard let view=view else{return}
?那些
s让我的眼睛受伤。这是从操场拍的,我是。