Skip to content

Instantly share code, notes, and snippets.

@nickbutcher
Last active September 4, 2024 05:58
Show Gist options
  • Save nickbutcher/29244da0ee9914001e09 to your computer and use it in GitHub Desktop.
Save nickbutcher/29244da0ee9914001e09 to your computer and use it in GitHub Desktop.
Demonstrating an animation for scanning a fingerprint and showing success or failure. This uses a number of AnimatedVectorDrawables (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) to 'morph' parts of the fingerprint into the tick or cross to report success or failure. It also uses a moving clip-pat…
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="pathData"
android:valueFrom="@string/path_ridge_2"
android:valueTo="@string/path_tick"
android:valueType="pathType"
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="strokeWidth"
android:valueFrom="@integer/fingerprint_stroke_width"
android:valueTo="@integer/tick_cross_stroke_width"
android:valueType="floatType"
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="trimPathStart"
android:valueFrom="0"
android:valueTo="0.5"
android:duration="400"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="trimPathEnd"
android:valueFrom="1"
android:valueTo="0.5"
android:duration="400"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="strokeAlpha"
android:valueFrom="1"
android:valueTo="0"
android:duration="400"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="pathData"
android:valueFrom="@string/path_ridge_2"
android:valueTo="@string/path_cross_1"
android:valueType="pathType"
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="strokeWidth"
android:valueFrom="@integer/fingerprint_stroke_width"
android:valueTo="@integer/tick_cross_stroke_width"
android:valueType="floatType"
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="pathData"
android:valueFrom="@string/path_ridge_5"
android:valueTo="@string/path_cross_2"
android:valueType="pathType"
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="strokeWidth"
android:valueFrom="@integer/fingerprint_stroke_width"
android:valueTo="@integer/tick_cross_stroke_width"
android:valueType="floatType"
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="trimPathStart"
android:valueFrom="0.5"
android:valueTo="0"
android:valueType="floatType"
android:duration="500"
android:interpolator="@android:interpolator/decelerate_quint" />
<objectAnimator
android:propertyName="trimPathEnd"
android:valueFrom="0.5"
android:valueTo="1"
android:valueType="floatType"
android:duration="500"
android:interpolator="@android:interpolator/decelerate_quint" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="animate"
tools:context=".MainActivity">
<ImageView
android:id="@+id/fingerprint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/show_fingerprint"
android:background="@drawable/circle"
android:elevation="4dp"/>
</FrameLayout>
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.fingerprintscan;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class MainActivity extends Activity {
private ImageView iv;
private AnimatedVectorDrawable showFingerprint;
private AnimatedVectorDrawable scanFingerprint;
private AnimatedVectorDrawable fingerprintToTick;
private AnimatedVectorDrawable fingerprintToCross;
private boolean isDone = false;
private boolean success = true;
private int backgroundColor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
iv = (ImageView) findViewById(R.id.fingerprint);
backgroundColor = getColor(R.color.circle_default);
showFingerprint = (AnimatedVectorDrawable) getDrawable(R.drawable.show_fingerprint);
scanFingerprint = (AnimatedVectorDrawable) getDrawable(R.drawable.scan_fingerprint);
fingerprintToTick = (AnimatedVectorDrawable) getDrawable(R.drawable.fingerprint_to_tick);
fingerprintToCross = (AnimatedVectorDrawable) getDrawable(R.drawable.fingerprint_to_cross);
scanFingerprint.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (success) {
iv.setImageDrawable(fingerprintToTick);
fingerprintToTick.start();
setCircleColor(getColor(R.color.circle_success));
} else {
iv.setImageDrawable(fingerprintToCross);
fingerprintToCross.start();
setCircleColor(getColor(R.color.circle_error));
}
success = !success;
}
});
iv.setImageDrawable(showFingerprint);
showFingerprint.start();
}
public void animate(View view) {
if (!isDone) {
iv.setImageDrawable(scanFingerprint);
scanFingerprint.start();
isDone = true;
} else {
iv.setImageDrawable(showFingerprint);
showFingerprint.start();
setCircleColor(getColor(R.color.circle_default));
isDone = false;
}
}
private void setCircleColor(int to) {
ObjectAnimator.ofArgb(iv.getBackground(), "color", backgroundColor, to).start();
backgroundColor = to;
}
}
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/fingerprint_width"
android:height="@dimen/fingerprint_height"
android:viewportWidth="@integer/fingerprint_viewport_width"
android:viewportHeight="@integer/fingerprint_viewport_height">
<group
android:name="fingerprint"
android:pivotX="@integer/fingerprint_viewport_center"
android:pivotY="@integer/fingerprint_viewport_center">
<path
android:name="ridge_1"
android:pathData="@string/path_ridge_1"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_2"
android:pathData="@string/path_ridge_2"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_3"
android:pathData="@string/path_ridge_3"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_4"
android:pathData="@string/path_ridge_4"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_5"
android:pathData="@string/path_ridge_5"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
</group>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<integer name="fingerprint_viewport_width">160</integer>
<integer name="fingerprint_viewport_height">160</integer>
<integer name="fingerprint_viewport_center">80</integer>
<integer name="fingerprint_stroke_width">5</integer>
<integer name="tick_cross_stroke_width">7</integer>
<dimen name="fingerprint_width">80dp</dimen>
<dimen name="fingerprint_height">80dp</dimen>
<!-- a pretty rough & ready re-draw of the fingerprint glyph from
https://github.com/googlesamples/android-FingerprintDialog -->
<string name="path_ridge_1">M56.2199243,45.3815903 C56.2199243,45.3815903 65.1913567,38.8543184 80.3604294,38.8543184 C95.5295022,38.8543184 103.720044,45.2851323 103.720044,45.2851323</string>
<string name="path_ridge_2">M45.5181172,67.9181841 C49.9761548,62.7019025 59.122049,49.7790452 80.2279027,49.7790452 C101.333756,49.7790452 110.740506,62.0384399 114.937688,67.9181841</string>
<string name="path_ridge_3">M51.7375623,107.718438 C51.7375623,107.718438 48.7129745,99.6302234 48.7129745,91.6334356 C48.7129745,81.3266864 55.9028711,60.2476586 80.4057228,60.2478671 C100.798248,60.2480407 112.457463,79.7942647 112.457463,88.386575 C112.457462,99.2963939 105.619846,103.039218 100.781849,102.18762 C95.9438519,101.336021 90.4490979,97.2187731 91.0639139,92.3178681 C91.67873,87.4169631 85.2177374,81.3265129 80.7504553,81.3266871 C73.0900115,81.3269859 69.8146331,85.3921834 69.8146329,92.2700585 C69.8146324,107.718437 83.7557525,121.02713 91.6787289,121.027128</string>
<string name="path_ridge_4">M70.7357889,121.024995 C70.7357889,121.024995 57.4650216,106.018711 58.8888756,91.5596242 C60.5513085,74.6777941 73.9858126,70.313752 80.3788823,70.3807995 C86.771952,70.4478469 101.550994,76.8218704 101.550997,92.2895418</string>
<string name="path_ridge_5">M80.1599645,91.1813411 C80.1599645,91.1813411 81.1144795,102.68333 86.7971146,107.529716 C93.2390527,113.023667 105.911091,112.342743 105.911091,112.342743</string>
<string name="path_tick">M52.2735573,79.0771904 C52.2735573,79.0771904 69.2403688,96.0440006 69.2403683,96.0440014 C69.2403679,96.0440021 109.820188,55.4641819 109.820188,55.4641819</string>
<string name="path_cross_1">M62,62 C62,62 80.5647617,80.5647617 80.564762,80.564762 C80.5647622,80.5647622 94.2921789,94.223714 98.5644262,98.5644262</string>
<string name="path_cross_2">M98.5644262,62 C98.5644251,62 81.1979242,79.366503 81.1979229,79.3665033 C81.1979216,79.3665035 62,98.5644262 62,98.5644262</string>
<!-- a 'window' which is ¼ of the height of the viewport that we use as a clip during the 'scan'
operation by animating it from the top to the bottom and back. -->
<string name="clip_path_scan_top">M0 0 L160 0 L160 40 L0 40 Z</string>
<string name="clip_path_scan_bottom">M0 120 L160 120 L160 160 L0 160 Z</string>
<color name="fingerprint_ridge">#deffffff</color>
<color name="fingerprint_ridge_scan">#ffffffff</color>
<color name="circle_default">#ff607d8b</color>
<color name="circle_success">#ff0f9d58</color>
<color name="circle_error">#ffdd2c00</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="@dimen/fingerprint_width"
android:height="@dimen/fingerprint_height"
android:viewportWidth="@integer/fingerprint_viewport_width"
android:viewportHeight="@integer/fingerprint_viewport_height">
<group
android:name="fingerprint">
<path
android:name="ridge_1"
android:pathData="@string/path_ridge_1"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_2"
android:pathData="@string/path_ridge_2"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_3"
android:pathData="@string/path_ridge_3"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_4"
android:pathData="@string/path_ridge_4"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_5"
android:pathData="@string/path_ridge_5"
android:strokeColor="@color/fingerprint_ridge"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
</group>
<!-- we overlay the above with a duplicate of the fingerprint which is colored differently
and uses a clip to only reveal portions at a time. -->
<group
android:name="fingerprint_scan">
<clip-path
android:name="scan_clip"
android:pathData="@string/clip_path_scan_top" />
<path
android:name="ridge_1"
android:pathData="@string/path_ridge_1"
android:strokeColor="@color/fingerprint_ridge_scan"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_2"
android:pathData="@string/path_ridge_2"
android:strokeColor="@color/fingerprint_ridge_scan"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_3"
android:pathData="@string/path_ridge_3"
android:strokeColor="@color/fingerprint_ridge_scan"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_4"
android:pathData="@string/path_ridge_4"
android:strokeColor="@color/fingerprint_ridge_scan"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
<path
android:name="ridge_5"
android:pathData="@string/path_ridge_5"
android:strokeColor="@color/fingerprint_ridge_scan"
android:strokeLineCap="round"
android:strokeWidth="@integer/fingerprint_stroke_width" />
</group>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/fingerprint_scan">
<target
android:name="scan_clip"
android:animation="@animator/scan" />
</animated-vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/fingerprint">
<target
android:name="ridge_1"
android:animation="@animator/hide_ridge" />
<target
android:name="ridge_2"
android:animation="@animator/morph_ridge_2_to_tick" />
<target
android:name="ridge_3"
android:animation="@animator/hide_ridge" />
<target
android:name="ridge_4"
android:animation="@animator/hide_ridge" />
<target
android:name="ridge_5"
android:animation="@animator/hide_ridge" />
</animated-vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/fingerprint">
<target
android:name="ridge_1"
android:animation="@animator/hide_ridge" />
<target
android:name="ridge_2"
android:animation="@animator/morph_ridge_2_to_cross_1" />
<target
android:name="ridge_3"
android:animation="@animator/hide_ridge" />
<target
android:name="ridge_4"
android:animation="@animator/hide_ridge" />
<target
android:name="ridge_5"
android:animation="@animator/morph_ridge_5_to_cross_2" />
</animated-vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/fingerprint">
<target
android:name="fingerprint"
android:animation="@animator/fingerprint_appear" />
<target
android:name="ridge_1"
android:animation="@animator/show_ridge" />
<target
android:name="ridge_2"
android:animation="@animator/show_ridge" />
<target
android:name="ridge_3"
android:animation="@animator/show_ridge" />
<target
android:name="ridge_4"
android:animation="@animator/show_ridge" />
<target
android:name="ridge_5"
android:animation="@animator/show_ridge" />
</animated-vector>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator
android:propertyName="scaleX"
android:valueFrom="0.4"
android:valueTo="1"
android:duration="300"
android:interpolator="@android:interpolator/decelerate_quint" />
<objectAnimator
android:propertyName="scaleY"
android:valueFrom="0.4"
android:valueTo="1"
android:duration="300"
android:interpolator="@android:interpolator/decelerate_quint" />
<objectAnimator
android:propertyName="alpha"
android:valueFrom="0"
android:valueTo="1"
android:duration="300"
android:interpolator="@android:interpolator/decelerate_quint" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="sequentially">
<objectAnimator
android:propertyName="pathData"
android:valueFrom="@string/clip_path_scan_top"
android:valueTo="@string/clip_path_scan_bottom"
android:valueType="pathType"
android:duration="800"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="pathData"
android:valueFrom="@string/clip_path_scan_bottom"
android:valueTo="@string/clip_path_scan_top"
android:valueType="pathType"
android:startOffset="50"
android:duration="500"
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
@vanlooverenkoen
Copy link

vanlooverenkoen commented Mar 1, 2018

drawable.registerAnimationCallback(object : Animatable2.AnimationCallback() {
               override fun onAnimationEnd(drawable: Drawable?) {
               }
})

@Aditya94A
Copy link

Aditya94A commented Jul 11, 2018

I wonder if there's a better way to use such gists other than copy-pasting one file at a time... Perhaps a pre-made folder with all the files in the correct directories, which when copied in a project's root directory places all relevant files in the right places all in one go.

@muthayashm
Copy link

Hey Nick,
You've forgot to add "@drawable/color.xml" file. It would be really of great help if you could provide it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment