8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

iOSでモーフィングアニメーション

Posted at

iOSで文字がいい感じに変わっていくアニメーションどうやって書くのかなと思って調べた時のメモです。

WWDC2017の「Advanced Animations with UIKit」の中でモーフィングのやり方について触れられていたのでそちらを参考にしました。

Aug-29-2017 01-51-33.gif

ポイント

  • 変化前後を別Viewにして重ねておく
  • UIViewPropertyAnimatorを使ってalphaとscaleを変化させる
    • Scaleは元のサイズから変化させる場合は変化前後のwidth, heightの比率をそれぞれ求める
    • Scaleが変化した状態からもとに戻す場合はCGAffineTransform.identityを指定する

サンプル実装はこちら

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?