Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Androidの物理ベースアニメーション

 Androidの物理ベースアニメーション

SpringAnimationクラスを例に、追加されたPhysics-based Animationの導入を紹介します。

Takahiro Shimokawa

December 18, 2017
Tweet

More Decks by Takahiro Shimokawa

Other Decks in Programming

Transcript

  1. Introduction — Twitter/GitHub : @androhi — Android application engineer at

    FiNC inc. — https://play.google.com/store/apps/details? id=jp.co.fincapp&hl=ja 2
  2. Android animation — Property Animation — ΦϒδΣΫτͷҐஔ΍େ͖͞ͳͲͷϓϩύςΟΛมԽͤ͞Δ — View Animation

    — ΞχϝʔγϣϯΛఆٛͨ͠xmlϑΝΠϧΛ࢖͏ — Drawable Animation — ύϥύϥອը — Physics-based Animation <- Added! — ෺ཧ๏ଇʹԊͬͨϦΞϧͳΞχϝʔγϣϯ 3
  3. Physics-based Animation — APIΨΠυ — https://developer.android.com/guide/topics/ graphics/physics-based-animation.html — Google I/O

    2017 video (Android Animations Spring to Life) — https://www.youtube.com/watch?v=BNcODK-Ju0g 4
  4. Create spring animation val springAnimation = SpringAnimation(imageView, SpringAnimation.TRANSLATION_X) springAnimation.spring =

    SpringForce().apply { // ݮਰ཰Λઃఆ dampingRatio = SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY // ߶ੑΛઃఆ stiffness = SpringForce.STIFFNESS_MEDIUM } springAnimation.start() 7