Animated icons

This commit is contained in:
Zakhar Timoshenko
2022-07-21 00:06:46 +03:00
parent 2306330fd0
commit 27177996d3
5 changed files with 125 additions and 3 deletions

View File

@@ -0,0 +1,32 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:name="path"
android:pathData="M 4 17.82 C 4 17.36 4.146 16.911 4.416 16.539 C 4.687 16.166 5.069 15.889 5.506 15.747 C 5.944 15.604 6.416 15.604 6.854 15.747 C 7.291 15.889 7.673 16.166 7.944 16.539 C 8.214 16.911 8.36 17.36 8.36 17.82 C 8.36 18.398 8.13 18.953 7.721 19.361 C 7.313 19.77 6.758 20 6.18 20 C 5.602 20 5.047 19.77 4.639 19.361 C 4.23 18.953 4 18.398 4 17.82"
android:fillColor="#000000"/>
<path
android:name="path_1"
android:pathData="M 4 4.44 L 4 7.27 C 11.03 7.27 16.73 12.97 16.73 20 L 19.56 20 C 19.56 11.41 12.59 4.44 4 4.44 Z M 4 10.1 L 4 12.93 C 7.9 12.93 11.07 16.1 11.07 20 L 13.9 20 C 13.9 14.53 9.47 10.1 4 10.1 Z"
android:fillColor="#000000"/>
</vector>
</aapt:attr>
<target android:name="path_1">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="pathData"
android:duration="@integer/config_defaultAnimTime"
android:valueFrom="M 4 10.1 L 4 12.93 C 7.9 12.93 11.07 16.1 11.07 20 L 13.9 20 C 13.9 14.53 9.47 10.1 4 10.1 Z M 4 4.44 L 4 7.27 C 11.03 7.27 16.73 12.97 16.73 20 L 19.56 20 C 19.56 11.41 12.59 4.44 4 4.44 Z"
android:valueTo="M 4 4.44 L 4 7.27 C 11.03 7.27 16.73 12.97 16.73 20 L 19.56 20 C 19.56 11.41 12.59 4.44 4 4.44 Z M 4 10.1 L 4 12.93 C 7.9 12.93 11.07 16.1 11.07 20 L 13.9 20 C 13.9 14.53 9.47 10.1 4 10.1 Z"
android:valueType="pathType"
android:interpolator="@android:anim/anticipate_overshoot_interpolator"/>
</aapt:attr>
</target>
</animated-vector>

View File

@@ -0,0 +1,47 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="32dp"
android:height="32dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:name="path"
android:pathData="M 27 23.2 L 17.7 14.3 C 18.6 11.9 18.1 9.2 16.1 7.3 C 13.8 5 10.2 4.9 7.7 6.8 L 11.6 10.6 L 10.2 12 L 6.3 8.3 C 4.5 10.9 4.8 14.5 7.1 16.7 C 9 18.5 11.7 19 14.1 18 L 23.4 26.9 C 23.8 27.3 24.4 27.3 24.8 26.9 L 27.1 24.6 C 27.4 24.2 27.4 23.6 27 23.2 M 24 24.8 L 14.3 15.5 C 13.7 16 13 16.2 12.3 16.4 C 10.9 16.6 9.5 16.2 8.4 15.2 C 7.4 14.3 7 13 7 11.8 L 10.2 14.8 L 14.4 10.5 L 11.2 7.5 C 12.5 7.4 13.7 7.8 14.7 8.8 C 15.8 9.9 16.2 11.3 16 12.7 C 15.9 13.4 15.6 14.1 15.2 14.7 L 24.9 24 L 24 24.8 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
</vector>
</aapt:attr>
<target android:name="path">
<aapt:attr name="android:animation">
<set>
<objectAnimator
android:propertyName="pathData"
android:duration="@integer/config_defaultAnimTime"
android:valueFrom="M 30 25.2 L 18 13.2 C 19.2 10.1 18.6 6.5 16.1 4 C 13.1 1 8.4 0.7 5 3.1 L 10.1 8.2 L 8.2 10 L 3.1 5 C 0.7 8.4 1 13.1 4 16.1 C 6.5 18.6 10 19.2 13.1 18.1 L 25.1 30.1 C 25.6 30.6 26.4 30.6 27 30.1 L 30 27.1 C 30.5 26.6 30.5 25.8 30 25.2 M 26.1 27.3 L 13.6 14.9 C 12.8 15.5 11.9 15.9 11 16 C 9.2 16.3 7.3 15.7 5.9 14.4 C 4.6 13 4 11.4 4.1 9.7 L 8.2 13.8 L 13.8 8.2 L 9.7 4.1 C 11.4 4 13 4.6 14.2 5.9 C 15.6 7.3 16.2 9.3 15.8 11.1 C 15.6 12 15.2 12.9 14.6 13.7 L 27.1 26.2 L 26.1 27.3 Z"
android:valueTo="M 27.7 0.5 L 16.1 6 C 14.2 4.3 11.5 3.9 9 5 C 6.1 6.4 4.7 9.7 5.6 12.7 L 10.5 10.4 L 11.3 12.2 L 6.4 14.5 C 8.2 17.1 11.6 18.1 14.6 16.7 C 17 15.6 18.3 13.2 18.3 10.7 L 30 5.2 C 30.5 5 30.7 4.4 30.5 3.9 L 29 1 C 28.8 0.5 28.2 0.3 27.7 0.5 M 28.2 3.8 L 16.1 9.6 C 16.3 10.3 16.3 11.1 16.2 11.8 C 15.9 13.1 15.1 14.4 13.7 15 C 12.5 15.6 11.2 15.6 10 15.1 L 13.9 13.2 L 11.3 7.8 L 7.3 9.7 C 7.7 8.5 8.5 7.5 9.7 6.9 C 11.3 6.2 12.8 6.3 14 7 C 14.6 7.4 15.2 7.9 15.6 8.5 L 27.7 2.7 L 28.2 3.8 Z"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
<objectAnimator
android:propertyName="pathData"
android:startOffset="300"
android:duration="@integer/config_defaultAnimTime"
android:valueFrom="M 27.7 0.5 L 16.1 6 C 14.2 4.3 11.5 3.9 9 5 C 6.1 6.4 4.7 9.7 5.6 12.7 L 10.5 10.4 L 11.3 12.2 L 6.4 14.5 C 8.2 17.1 11.6 18.1 14.6 16.7 C 17 15.6 18.3 13.2 18.3 10.7 L 30 5.2 C 30.5 5 30.7 4.4 30.5 3.9 L 29 1 C 28.8 0.5 28.2 0.3 27.7 0.5 M 28.2 3.8 L 16.1 9.6 C 16.3 10.3 16.3 11.1 16.2 11.8 C 15.9 13.1 15.1 14.4 13.7 15 C 12.5 15.6 11.2 15.6 10 15.1 L 13.9 13.2 L 11.3 7.8 L 7.3 9.7 C 7.7 8.5 8.5 7.5 9.7 6.9 C 11.3 6.2 12.8 6.3 14 7 C 14.6 7.4 15.2 7.9 15.6 8.5 L 27.7 2.7 L 28.2 3.8 Z"
android:valueTo="M 30.7 8.4 L 17.8 8.6 C 16.8 6.3 14.4 4.7 11.8 4.8 C 8.5 4.9 5.9 7.3 5.5 10.4 L 10.9 10.3 L 10.9 12.3 L 5.5 12.4 C 6 15.5 8.8 17.8 12 17.8 C 14.6 17.7 16.9 16.1 17.8 13.9 L 30.7 13.6 C 31.3 13.6 31.7 13.1 31.7 12.6 L 31.6 9.3 C 31.7 8.8 31.2 8.3 30.7 8.4 M 29.7 11.6 L 16.3 11.9 C 16.2 12.7 15.9 13.3 15.5 13.9 C 14.7 15 13.4 15.8 11.9 15.8 C 10.6 15.8 9.4 15.3 8.5 14.4 L 12.9 14.3 L 12.8 8.3 L 8.5 8.4 C 9.3 7.5 10.5 6.9 11.8 6.8 C 13.3 6.8 14.7 7.5 15.5 8.6 C 15.9 9.2 16.2 9.9 16.3 10.6 L 29.7 10.3 L 29.7 11.6 Z"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
<objectAnimator
android:propertyName="pathData"
android:startOffset="600"
android:duration="@integer/config_defaultAnimTime"
android:valueFrom="M 30.7 8.4 L 17.8 8.6 C 16.8 6.3 14.4 4.7 11.8 4.8 C 8.5 4.9 5.9 7.3 5.5 10.4 L 10.9 10.3 L 10.9 12.3 L 5.5 12.4 C 6 15.5 8.8 17.8 12 17.8 C 14.6 17.7 16.9 16.1 17.8 13.9 L 30.7 13.6 C 31.3 13.6 31.7 13.1 31.7 12.6 L 31.6 9.3 C 31.7 8.8 31.2 8.3 30.7 8.4 M 29.7 11.6 L 16.3 11.9 C 16.2 12.7 15.9 13.3 15.5 13.9 C 14.7 15 13.4 15.8 11.9 15.8 C 10.6 15.8 9.4 15.3 8.5 14.4 L 12.9 14.3 L 12.8 8.3 L 8.5 8.4 C 9.3 7.5 10.5 6.9 11.8 6.8 C 13.3 6.8 14.7 7.5 15.5 8.6 C 15.9 9.2 16.2 9.9 16.3 10.6 L 29.7 10.3 L 29.7 11.6 Z"
android:valueTo="M 30 25.2 L 18 13.2 C 19.2 10.1 18.6 6.5 16.1 4 C 13.1 1 8.4 0.7 5 3.1 L 10.1 8.2 L 8.2 10 L 3.1 5 C 0.7 8.4 1 13.1 4 16.1 C 6.5 18.6 10 19.2 13.1 18.1 L 25.1 30.1 C 25.6 30.6 26.4 30.6 27 30.1 L 30 27.1 C 30.5 26.6 30.5 25.8 30 25.2 M 26.1 27.3 L 13.6 14.9 C 12.8 15.5 11.9 15.9 11 16 C 9.2 16.3 7.3 15.7 5.9 14.4 C 4.6 13 4 11.4 4.1 9.7 L 8.2 13.8 L 13.8 8.2 L 9.7 4.1 C 11.4 4 13 4.6 14.2 5.9 C 15.6 7.3 16.2 9.3 15.8 11.1 C 15.6 12 15.2 12.9 14.6 13.7 L 27.1 26.2 L 26.1 27.3 Z"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
</set>
</aapt:attr>
</target>
</animated-vector>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/normal"
android:drawable="@drawable/ic_feed"
android:state_checked="false" />
<item
android:id="@+id/checked"
android:drawable="@drawable/ic_feed"
android:state_checked="true" />
<transition
android:drawable="@drawable/avd_feed_enter_leave"
android:fromId="@id/normal"
android:toId="@id/checked" />
<transition
android:drawable="@drawable/avd_feed_enter_leave"
android:fromId="@id/checked"
android:toId="@id/normal" />
</animated-selector>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/normal"
android:drawable="@drawable/ic_tools"
android:state_checked="false" />
<item
android:id="@+id/checked"
android:drawable="@drawable/ic_tools"
android:state_checked="true" />
<transition
android:drawable="@drawable/avd_tools_enter"
android:fromId="@id/normal"
android:toId="@id/checked" />
</animated-selector>

View File

@@ -14,12 +14,12 @@
<item
android:id="@+id/nav_feed"
android:icon="@drawable/ic_feed"
android:icon="@drawable/ic_feed_selector"
android:title="@string/updates" />
<item
android:id="@+id/nav_tools"
android:icon="@drawable/ic_tools"
android:icon="@drawable/ic_tools_selector"
android:title="@string/tools" />
</menu>
</menu>