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

Play with animations! (2015)

Play with animations! (2015)

Material Design: Animation Meaningful transitions Hierarchical timing

Avatar for Omar Miatello

Omar Miatello

October 04, 2015
Tweet

More Decks by Omar Miatello

Other Decks in Technology

Transcript

  1. Play with animations! - AnimationUtils.java fun View.animateAppear() { alpha =

    0f scaleX = 0f scaleY = 0f val animator = ViewCompat.animate(this).alpha(1f).scaleX(1f).scaleY(1f) animator.start() }
  2. Play with animations! - AnimationUtils.java fun View.animateAppear() { alpha =

    0f scaleX = 0f scaleY = 0f val animator = ViewCompat.animate(this).alpha(1f).scaleX(1f).scaleY(1f) animator.start() } fun calcDistance(x1: Int, y1: Int, x2: Int, y2: Int) = Math.sqrt(((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)).toDouble())
  3. Play with animations! - AnimationUtils.java fun View.animateAppear() { alpha =

    0f scaleX = 0f scaleY = 0f val animator = ViewCompat.animate(this).alpha(1f).scaleX(1f).scaleY(1f) animator.start() } fun calcDistance(x1: Int, y1: Int, x2: Int, y2: Int) = Math.sqrt(((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)).toDouble()) fun List<View>.animateRelativeHierarchicalTiming(centerX: Int = 0, centerY: Int = 0) { forEach { val x = it.left val y = it.top val distance = calcDistance(centerX, centerY, x, y) it.postDelayed({ it.animateAppear() }, distance.toLong()) } }
  4. Play with animations! - AnimationUtils.java fun View.animateAppear() { alpha =

    0f scaleX = 0f scaleY = 0f val animator = ViewCompat.animate(this).alpha(1f).scaleX(1f).scaleY(1f) animator.start() } fun calcDistance(x1: Int, y1: Int, x2: Int, y2: Int) = Math.sqrt(((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)).toDouble()) fun List<View>.animateRelativeHierarchicalTiming(centerX: Int = 0, centerY: Int = 0) { forEach { val x = it.left val y = it.top val distance = calcDistance(centerX, centerY, x, y) it.postDelayed({ it.animateAppear() }, distance.toLong()) } }
  5. Omar Miatello Member of GDG Milano (Italy) Android Developer @

    Satispay Personal profile google.com/+OmarMiatello Google+ Community: Kotlin for Android goo.gl/mUKF1w Slides of DevFest 2015 - Milano goo.gl/7Vhy0s