I'm noticing that if I pause a fast moving `UIViewPropertyAnimator` it jumps back a frame which is... not great.

is there a way around that? am i doing something wrong? or just a tradeoff for the the way this api works?

(context: I have a box moving from one point on the screen to another, and on `touchesBegan` I pause the animator to "catch" the box. because of the frame jump, it then feels off)

Here's a frame by frame video. Note the sudden snap back.

It's visually ahead a frame but pausing the animator puts it back a frame

@edwellbrook maybe @b3ll or @christianselig could help? they've posted about UIKit animation gesture interaction before i think

@Joekw @edwellbrook @christianselig that's kinda whack, I don't think I've seen that before. What're you using for the property animator’s settings?

As a sledgehammer approach you could just stop / create a new property animator (which is often what I do anyways)

@b3ll @Joekw Seems I'm maybe not alone... (unconfirmed) https://elk.zone/mastodon.social/@tanmay/110468593385921104

The property animator is just using super basic linear "curve" with a duration. No velocity, springs etc.

pause then continue/start. On pause it seemingly jumps back a frame.

Can't create a new animator because... on pause it has immediately jumped back so no way to grab the frame that was on screen (monitoring w/ displaylink doesn't help, presentation frame is delayed).

tanmay (@[email protected])

Attached: 1 video @edwellbrook I just realised the same thing happens in the player transition in Soor. I knew something looked off but didn’t think much of it. I’ll investigate this and report back if I find a solution.

Mastodon

@b3ll @Joekw And i can't create a new animator because of the `UIViewControllerAnimatedTransitioning` api contract "You must return the same animator object for the duration of the transition." https://developer.apple.com/documentation/uikit/uiviewcontrolleranimatedtransitioning/1829434-interruptibleanimator

🤡😢

interruptibleAnimator(using:) | Apple Developer Documentation

Returns the interruptible animator to use during the transition.

Apple Developer Documentation
@edwellbrook I just realised the same thing happens in the player transition in Soor. I knew something looked off but didn’t think much of it. I’ll investigate this and report back if I find a solution.

@tanmay Which version of iOS is this running in?

My video was pulled from latest 16.5 beta. I haven't checked individual frames yet, but maybe seems OK in 16.4 simulator. 🤷‍♂️

I'm thinking I'll file a radar

@edwellbrook This is from a 14 Pro Max running on 16.5. I haven’t debugged this yet, only ran my app to verify the behaviour but it’s likely the same thing which you figured out. I’ll dig a bit into this later and file a radar as well.