Commit eeee26a3 by Daniel Dahan

development: added point MotionAnimation enum value

parent ef6923c7
...@@ -80,6 +80,7 @@ public enum MotionAnimation { ...@@ -80,6 +80,7 @@ public enum MotionAnimation {
case translateZ(CGFloat) case translateZ(CGFloat)
case x(CGFloat) case x(CGFloat)
case y(CGFloat) case y(CGFloat)
case point(x: CGFloat, y: CGFloat)
case position(x: CGFloat, y: CGFloat) case position(x: CGFloat, y: CGFloat)
case shadow(path: CGPath) case shadow(path: CGPath)
case fade(CGFloat) case fade(CGFloat)
...@@ -242,6 +243,8 @@ extension CALayer { ...@@ -242,6 +243,8 @@ extension CALayer {
a.append(Motion.position(to: CGPoint(x: x + w / 2, y: s.position.y))) a.append(Motion.position(to: CGPoint(x: x + w / 2, y: s.position.y)))
case let .y(y): case let .y(y):
a.append(Motion.position(to: CGPoint(x: s.position.x, y: y + h / 2))) a.append(Motion.position(to: CGPoint(x: s.position.x, y: y + h / 2)))
case let .point(x, y):
a.append(Motion.position(to: CGPoint(x: x + w / 2, y: y + h / 2)))
case let .position(x, y): case let .position(x, y):
a.append(Motion.position(to: CGPoint(x: x, y: y))) a.append(Motion.position(to: CGPoint(x: x, y: y)))
case let .shadow(path): case let .shadow(path):
......
...@@ -495,6 +495,9 @@ open class MotionTransitionPresentedAnimator: MotionTransitionDelegate, UIViewCo ...@@ -495,6 +495,9 @@ open class MotionTransitionPresentedAnimator: MotionTransitionDelegate, UIViewCo
px = x + w / 2 px = x + w / 2
case let .y(y): case let .y(y):
py = y + h / 2 py = y + h / 2
case let .point(x, y):
px = x + w / 2
py = y + h / 2
default:break default:break
} }
} }
...@@ -513,10 +516,8 @@ open class MotionTransitionPresentedAnimator: MotionTransitionDelegate, UIViewCo ...@@ -513,10 +516,8 @@ open class MotionTransitionPresentedAnimator: MotionTransitionDelegate, UIViewCo
a.append(Motion.background(color: color)) a.append(Motion.background(color: color))
case let .corners(radius): case let .corners(radius):
a.append(Motion.corner(radius: radius)) a.append(Motion.corner(radius: radius))
case let .x(x): case let .x(_), .y(_), .point(_, _):
a.append(Motion.position(to: CGPoint(x: x + w / 2, y: py))) a.append(Motion.position(to: CGPoint(x: px, y: py)))
case let .y(y):
a.append(Motion.position(to: CGPoint(x: px, y: y + h / 2)))
case let .position(x, y): case let .position(x, y):
a.append(Motion.position(to: CGPoint(x: x, y: y))) a.append(Motion.position(to: CGPoint(x: x, y: y)))
case let .shadow(path): case let .shadow(path):
...@@ -614,12 +615,8 @@ open class MotionTransitionDismissedAnimator: MotionTransitionDelegate, UIViewCo ...@@ -614,12 +615,8 @@ open class MotionTransitionDismissedAnimator: MotionTransitionDelegate, UIViewCo
a.append(Motion.background(color: .clear)) a.append(Motion.background(color: .clear))
case let .corners(radius): case let .corners(radius):
a.append(Motion.corner(radius: v2.cornerRadius)) a.append(Motion.corner(radius: v2.cornerRadius))
case let .x(x): case let .x(_), .y(_), .point(_, _), .position(_, _):
a.append(Motion.position(to: v2.position)) a.append(Motion.position(to: nil == v2.superview ? v2.position : v2.superview!.convert(v2.position, to: nil)))
case let .y(y):
a.append(Motion.position(to: v2.position))
case let .position(x, y):
a.append(Motion.position(to: v2.position))
case let .shadow(path): case let .shadow(path):
a.append(Motion.shadow(path: path)) a.append(Motion.shadow(path: path))
case let .width(w): case let .width(w):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment