Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
Start pop springs in the active state.
Browse files Browse the repository at this point in the history
Summary: POP animations don't invoke the "did start" block until the turn of the run loop, which means our transition directors might appear to be at rest after describing a series of pop springs even though the springs will take effect soon. This diff ensures that the spring is represented as active immediately.

Reviewers: O2 Material Motion, #material_motion, O4 Material Apple platform reviewers, chuga

Reviewed By: O4 Material Apple platform reviewers, chuga

Subscribers: chuga

Tags: #material_motion

Differential Revision: http://codereview.cc/D2391
  • Loading branch information
jverkoey committed Dec 20, 2016
1 parent d618b99 commit 0aa1c1d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sources/popSpringSource.swift
Expand Up @@ -69,6 +69,12 @@ private func configureSpringAnimation<T>(_ animation: POPSpringAnimation, spring
animation.removedOnCompletion = false
animation.velocity = spring.initialVelocity.read()

// animationDidStartBlock is invoked at the turn of the run loop, potentially leaving this stream
// in an at rest state even though it's effectively active. To ensure that the stream is marked
// active until the run loop turns we immediately send an .active state to the observer.

observer.state(.active)

animation.animationDidStartBlock = { anim in
observer.state(.active)
}
Expand Down

0 comments on commit 0aa1c1d

Please sign in to comment.