Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Butcher nickbutcher

View GitHub Profile
@nickbutcher
nickbutcher / 1 search_bar.xml
Last active Mar 22, 2021
Demonstrating morphing a search icon into a search field. To do this we use an AnimatedVectorDrawable (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) made up of two paths. The first is the search icon (as a single line) the second is the horizontal bar. We then animate the 'trimPathStart' property …
View 1 search_bar.xml
<?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
@nickbutcher
nickbutcher / 10: animator-morph_ridge_2_to_tick.xml
Last active Feb 20, 2021
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…
View 10: animator-morph_ridge_2_to_tick.xml
<?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
@nickbutcher
nickbutcher / 1_drawable_ic_hash_io16.xml
Last active Jun 16, 2020
Animated Stroke. The google I/O website this year (https://google.com/io) has some funky animated lettering. I especially liked the animated stroke around the letters and wondered how you might implement that on Android. Turns out that AnimatedVectorDrawable makes this very easy! Here's how it looks: https://twitter.com/crafty/status/71077957997…
View 1_drawable_ic_hash_io16.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Google Inc.
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
@nickbutcher
nickbutcher / avd_bundle.xml
Last active Jun 20, 2019
An example of the Android xml bundle format for creating an AnimatedVectorDrawable. See https://plus.google.com/+NickButcher/posts/A8KKxnJdg4r
View avd_bundle.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Google Inc.
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
@nickbutcher
nickbutcher / keybase.md
Created Nov 1, 2016
Keybase.io verification
View keybase.md

Keybase proof

I hereby claim:

  • I am nickbutcher on github.
  • I am nickbutcher (https://keybase.io/nickbutcher) on keybase.
  • I have a public key whose fingerprint is 73CC 3CFE 15F6 1A79 4DD3 E103 B483 09D2 BAEE 267E

To claim this, I am signing this object:

@nickbutcher
nickbutcher / a_stroke.xml
Created Nov 4, 2016
Trimming Paths. Code from Udacity course demonstrating trimming the path of an Android AnimatedVectorDrawable. https://www.youtube.com/watch?v=ecCSzKi-ZxM&t=2m12s
View a_stroke.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Google Inc.
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
View MainActivity.java
/*
* Copyright 2016 Google Inc.
*
* 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
View endless-pin-jump.iconanim
{
"artwork": {
"id": "vector",
"canvasColor": null,
"width": 800,
"height": 600,
"layers": [
{
"id": "horizon",
"type": "path",
View toast.iconanim
{
"artwork": {
"id": "vector",
"canvasColor": null,
"width": 24,
"height": 24,
"layers": [
{
"id": "group",
"type": "group",
View MainActivity.java
/*
* Copyright 2017 Google Inc.
*
* 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