LoginSignup
2
0

More than 1 year has passed since last update.

MotionLayoutの例を試してみる(キーフレームの補間)

Posted at

前回はキーフレームの位置をやりました。
キーフレームの位置

今回はキーフレームの補間を試していこうと思います。

公式リファレンス

リンク先に公式サンプルがあります。
キーフレームの補間

<KeyFrameSet>
  <KeyAttribute
    android:rotation="-45"
    android:scaleX="2"
    android:scaleY="2"
    motion:framePosition="50"
    motion:motionTarget="@id/button" />
</KeyFrameSet>

ビューの遷移に、回転とサイズ変更します。

KeyAttribute

framePositionとmotionTargetに関しては前回に書いたので今回は説明しないです。

rotationは回転の設定です。
-は左回転で、プラスは右回転です。
設定した数字分回転します。
今回は左回りで45°回転します。

scaleX、scaleYは大きさの設定です。
今回は2を設定している為縦横の大きさが2倍のサイズになりました。

以上です。
簡単にいろんなアニメーションができますね!

2
0
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
2
0