UIViewPropertyAnimatorとCornerRadius
CornerRadiusを設定してClipToBounds した UIView を UIViewPropertyAnimatorでアニメーションさせると、boundsの形が歪んでしまう。設定したCornerRadiusのままアニメーションさせるには、アニメーターの中でCornerRadiusも設定する。
UIViewPropertyAnimator.runningPropertyAnimator(withDuration: 1, delay: 0, options: [.curveEaseInOut]) {
animationView.frame = CGRect(x:100,y:100,width:100,height:100)
animationView.layer.cornerRadius = animationView.frame.height/2
} completion: { (UIViewAnimatingPosition) in
}
これでまんまるが歪まずにアニメーションしてくれる。
🐣
フリーランスエンジニアです。
お仕事のご相談こちらまで
[email protected]
Core MLを使ったアプリを作っています。
機械学習関連の情報を発信しています。
Author And Source
この問題について(UIViewPropertyAnimatorとCornerRadius), 我々は、より多くの情報をここで見つけました https://qiita.com/john-rocky/items/5b6391056e659cec39d7著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .