-
Notifications
You must be signed in to change notification settings - Fork 17
Disable implicit animations when adding explicit animations in the animator #20
Conversation
@@ -125,7 +125,10 @@ - (void)animateWithTiming:(MDMMotionTiming)timing | |||
} | |||
} | |||
|
|||
[CATransaction begin]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 123: Shouldn't the completion block be attached to the new CATransaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The completion block is attached to the explicit animation up above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
|
||
// Setting transform.rotation.z will create an implicit transform if implicit animations | ||
// aren't disabled by the animator properly, so verify that such an animation doesn't exist: | ||
XCTAssertNil(view.layer.animation(forKey: "transform")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also assert that the .rotation animation is not nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The animator's unfortunately adding the animation with a nil
key so we can't identify whether an animation was added after the fact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe count the number of animations attached to the object before adding and after adding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CALayer only provides animationKeys()
and animationForKey
. There's unfortunately no way to enumerate animations that were added with a nil key (that I know of).
@@ -125,7 +125,10 @@ - (void)animateWithTiming:(MDMMotionTiming)timing | |||
} | |||
} | |||
|
|||
[CATransaction begin]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
…imator. A client using the animator expects that it will only add animations for the key path that was specified, but it's possible that setting the final value for a given key path can create implicit animations. We now disable implicit animations when setting the final value to the layer.
A client using the animator expects that it will only add animations for the key path that was specified, but it's possible that setting the final value for a given key path can create implicit animations. We now disable implicit animations when setting the final value to the layer.