uiviewpropertyanimator

Repeating and reversing an animation multiple times using UIViewPropertyAnimator

夙愿已清 提交于 2020-07-18 08:10:48
问题 I am trying to have my animation ease the screen from black to white to black again and repeat that a certain amount of times. Currently with the code I have the animation eases from black to white then jumps back to black. Is there anyway to run an animation in reverse or add an animation that runs after the first animation is completed? override func viewDidAppear(_ animated: Bool) { let viewColorAnimator: UIViewPropertyAnimator = UIViewPropertyAnimator.runningPropertyAnimator( withDuration

Repeating and reversing an animation multiple times using UIViewPropertyAnimator

烈酒焚心 提交于 2020-07-18 08:09:32
问题 I am trying to have my animation ease the screen from black to white to black again and repeat that a certain amount of times. Currently with the code I have the animation eases from black to white then jumps back to black. Is there anyway to run an animation in reverse or add an animation that runs after the first animation is completed? override func viewDidAppear(_ animated: Bool) { let viewColorAnimator: UIViewPropertyAnimator = UIViewPropertyAnimator.runningPropertyAnimator( withDuration

Repeat/Autoreverse animations in iOS 13.x

折月煮酒 提交于 2020-04-13 09:09:52
问题 Previously in swift you could do this: let animator = UIViewPropertyAnimator(duration: 0.25, curve: .easeIn) { UIView.setAnimationRepeatCount(Float.infinity) UIView.setAnimationRepeatAutoreverses(true) let transform = CATransform3DIdentity let rotate = CATransform3DRotate(transform, 45, 1, 1, 0) self.ex.layer.transform = rotate } However, now there is a deprecation message on UIView.setAnimationRepeatCount and UIView.setAnimationRepeatAutoreverses . Does anybody know what they was replaced

UIView center position during animation

≡放荡痞女 提交于 2019-12-23 04:49:13
问题 I would like to determine, what is the center position of a UIVIew (the middle point of the view) during an animation. An animation with UIViewPropertyAnimator like this: let animator = UIViewPropertyAnimator(duration: 10, curve: .easeInOut) var circle : UIView! circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 40.0, height: 40.0)) circle.layer.cornerRadius = 20.0 circle.backgroundColor = UIColor.blue self.view.addSubview(circle) animator.addAnimations { circle.center = CGPoint(x: 100,y:

UIViewPropertyAnimator does not update the view when expected

隐身守侯 提交于 2019-12-11 04:31:09
问题 Here is a Swift playground code, which I also tested in the iOS Simulator just to be sure that it's not an issue of Playground. Setting the property fractionComplete result in change of state from inactive to active . However as shown below the view is not updated for the first two calls. Only the third call magically updates the view. This behavior is confusing and I seek for explanation. let liveView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 50)) liveView.backgroundColor =

UIViewPropertyAnimator different behaviour on iOS10 and iOS11 reversing an animation. Bug on `isReversed` and `fractionComplete` properties?

戏子无情 提交于 2019-12-09 05:52:36
问题 THE PROBLEM Running the same code on iOS10 and iOS11 my UIViewPropertyAnimator has a different behaviour just after changing of his .isReversed property. Everything is ok on iOS10. The animation problem happens on iOS11 CONDITIONS It's true for any animations, not only for a particular one, and it is verifiable both by watching the animation and within the code. It happens both on simulators and real devices. DETAILS Once created a UIViewPropertyAnimator with his animation, during its running

UIViewPropertyAnimator issue with Autolayout

為{幸葍}努か 提交于 2019-12-08 12:33:15
问题 Here is the code of what I tried to repeat according to Apple WWDC but with autolayout: extension AugmentedReallityViewController { @objc func handlePan(recognizer: UIPanGestureRecognizer) { // // hide languages and units anyway // moveUnitView(show: false) // moveLanguageView(show: false) // // let isNowExpanded = settingsPanelState == SettingsPanelState.expanded // let newState = isNowExpanded ? SettingsPanelState.collapsed : SettingsPanelState.expanded // // switch recognizer.state { //

Is there a way to observe changes to fractionComplete in UIViewPropertyAnimator

≯℡__Kan透↙ 提交于 2019-12-04 09:02:39
问题 I've been looking at the very cool new UIViewPropertyAnimator class in iOS 10. It lets you easily do things like pause, resume, and reverse in-flight UIView animations. It used to be that you had to manipulate the underlying CAAnimations the system created in order to do that with UIView animations. The new UIViewPropertyAnimator class has a property fractionComplete . It varies from 0.0 (beginning of animation) to 1.0 (end of animation.) If you change the value, you can "scrub" an animation

UIViewPropertyAnimator different behaviour on iOS10 and iOS11 reversing an animation. Bug on `isReversed` and `fractionComplete` properties?

梦想与她 提交于 2019-12-03 06:15:20
THE PROBLEM Running the same code on iOS10 and iOS11 my UIViewPropertyAnimator has a different behaviour just after changing of his .isReversed property. Everything is ok on iOS10. The animation problem happens on iOS11 CONDITIONS It's true for any animations, not only for a particular one, and it is verifiable both by watching the animation and within the code. It happens both on simulators and real devices. DETAILS Once created a UIViewPropertyAnimator with his animation, during its running I just call .pauseAnimation() and change the .isReversed property to true . After that I resume the

Is there a way to observe changes to fractionComplete in UIViewPropertyAnimator

走远了吗. 提交于 2019-12-03 01:46:18
I've been looking at the very cool new UIViewPropertyAnimator class in iOS 10. It lets you easily do things like pause, resume, and reverse in-flight UIView animations. It used to be that you had to manipulate the underlying CAAnimations the system created in order to do that with UIView animations. The new UIViewPropertyAnimator class has a property fractionComplete . It varies from 0.0 (beginning of animation) to 1.0 (end of animation.) If you change the value, you can "scrub" an animation from beginning to end. I have a demo project on Github called KeyframeViewAnimations that lets you use