Fix spring animation

This commit is contained in:
Ali
2021-11-20 17:58:30 +04:00
parent e45bad1616
commit 68986f9e5b
3 changed files with 16 additions and 6 deletions

View File

@@ -151,7 +151,7 @@ public extension CALayer {
let animationGroup = CAAnimationGroup()
var timeOffset = 0.0
for animation in animations {
animation.beginTime = animation.beginTime + timeOffset
animation.beginTime = self.convertTime(animation.beginTime, from: nil) + timeOffset
timeOffset += animation.duration / Double(animation.speed)
}
animationGroup.animations = animations
@@ -217,7 +217,7 @@ public extension CALayer {
}
if !delay.isZero {
animation.beginTime = CACurrentMediaTime() + delay * UIView.animationDurationFactor()
animation.beginTime = self.convertTime(CACurrentMediaTime(), from: nil) + delay * UIView.animationDurationFactor()
animation.fillMode = .both
}