LoginSignup
22
16

More than 5 years have passed since last update.

【Swift】UIViewAnimationOptionsのCurveを比較

Last updated at Posted at 2016-01-23

はじめに

animateWithDuration(_:delay:options:animations:completion:)
を使用してアニメーションさせる際のUIViewAnimationOptionsの設定について以下の4つの違いを視覚的に比較したかったので、シンプルなサンプルを作成しました。

  • Linear
  • EaseIn
  • EaseOut
  • EaseInOut

サンプル

以下Githubにサンプルプロジェクトをあげています。
また、Youtubeにサンプルプロジェクトを動作させた動画をあげているので、あわせてご覧ください。

Github: https://github.com/taji-taji/SwiftSimpleAnimationSample
Youtube: https://www.youtube.com/watch?v=XoTJK8EVFv8

sample movie

動作環境

iOS: 9.2
Xcode: 7.2

UIViewAnimationOptions(Curve系のみ)

UIViewAnimationOptions のCurve系のもののみ簡単に説明します。

Linear

一定速度で移動します。

CurveEaseIn

動き始めがゆっくりになります。

CurveEaseOut

動き終わりがゆっくりになります。

CurveEaseInOut

ゆっくり動き始め、ゆっくり止まります。

最後に

アニメーションの基本的なことだと思うのですが、これまであまり触れていなかったので視覚的に比較しないとイメージがわきにくく今回のサンプルを作りました。

また、今回はシンプルなアニメーションですが、アニメーション系はもっと細かく設定できると思うので今後はその辺りも見ていきたいと思います。

リファレンス

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/c/tdef/UIViewAnimationOptions
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/doc/uid/TP40006816-CH3-SW108

22
16
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
22
16