Does Google allow for icon transitions such as these to be created by the developer? Or is it the developers responsibility to create such "delightful" transitions? I'd really like to implement these in my app.
Specifically icons like this
Does Google allow for icon transitions such as these to be created by the developer? Or is it the developers responsibility to create such "delightful" transitions? I'd really like to implement these in my app.
Specifically icons like this
You can create an animated icon using AnimatedDrawable and bitmap-based frames. On L, you can use AnimatedStateListDrawable to create stateful animations (such as the check box animation).
Here is an AnimatedDrawable example (actually this is the implementation for the check box on L preview) using 15ms-long frames that can be started and stopped from code:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="15" android:drawable="@drawable/my_icon_frame_000" />
...additional frames...
</animation-list>
And here is an AnimatedStateListDrawable using AnimatedDrawable transitions to implement a check box animation that starts and stops automatically based on View state:
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:state_checked="true">
<bitmap android:src="@drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorControlActivated" android:alpha="?attr/disabledAlpha" />
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" android:alpha="?attr/disabledAlpha" />
</item>
<item android:state_checked="true" android:id="@+id/on">
<bitmap android:src="@drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorControlActivated" />
</item>
<item android:id="@+id/off">
<bitmap android:src="@drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" />
</item>
<transition android:fromId="@+id/off" android:toId="@+id/on">
<animation-list>
<item android:duration="15">
<bitmap android:src="@drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" />
</item>
...additional frames...
</animation-list>
</transition>
<transition android:fromId="@+id/on" android:toId="@+id/off">
<animation-list>
<item android:duration="15">
<bitmap android:src="@drawable/btn_check_to_off_mtrl_000" android:tint="?attr/colorControlActivated" />
</item>
...additional frames...
</animation-list>
</transition>
</animated-selector>