Thursday, June 27, 2024
HomeiOS Developmentios - Easy methods to get Spring Animations with Constraints to behave...

ios – Easy methods to get Spring Animations with Constraints to behave correctly?


Making an attempt to get a spring animation to work correctly. I made a git repo. Principally the purple view is constrained as follows:

let ac = brokenView.widthAnchor.constraint(equalTo: brokenView.heightAnchor, multiplier: 9/16)
let xc = brokenView.centerXAnchor.constraint(equalTo: animView.centerXAnchor)
let yc = brokenView.centerYAnchor.constraint(equalTo: animView.centerYAnchor)
let widthC = brokenView.widthAnchor.constraint(equalTo: animView.widthAnchor)
widthC.precedence = .defaultLow
let gewc = brokenView.widthAnchor.constraint(greaterThanOrEqualTo: animView.widthAnchor)
let geHC = brokenView.heightAnchor.constraint(greaterThanOrEqualTo: animView.heightAnchor)
geHC.precedence = .required

Blue view begins at facet ratio != 9/16 -> is animated to 9/16. What I might prefer to see is when the blue view will get too tall, the purple view begins to get fats. As an alternative it simply adheres to the decrease precedence width anchor. Any recommendation is appreciated.

Repo Right here

It's Broken



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments