File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
magic/src/main/java/br/com/bloder/magic/internal Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ package br.com.bloder.magic.internal
2
+
3
+ import android.view.View
4
+ import android.view.animation.Animation
5
+ import android.view.animation.Transformation
6
+
7
+ /* *
8
+ * Created by bloder on 20/09/16.
9
+ */
10
+ class MagicAnimation (view : View ) : Animation() {
11
+
12
+ private var view : View ? = view
13
+ private val startWidth : Int = view.width
14
+ private val toWidth : Int = if (startWidth == view.height) startWidth * 4 else view.height
15
+
16
+ override fun applyTransformation (interpolatedTime : Float , t : Transformation ? ) {
17
+ val newWidth : Int = startWidth + ((toWidth - startWidth) * interpolatedTime).toInt()
18
+ view?.layoutParams?.width = newWidth
19
+ view?.requestLayout()
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments