Rich Path


Source link: https://github.com/tarek360/RichPath/

💪 Rich Android Path. 🤡 Draw as you want. 🎉 Animate much as you can.

Download sample app:

Features

  • Full Animation Control on Paths and VectorDrawables: Animate any attribute in a specific path in the VectorDrawable

fillColor, strokeColor, strokeAlpha, fillAlpha, size, width, height, scale, scaleX, scaleY, rotation, translationX, translationY, trimPathStart, trimPathEnd, trimPathOffset.

  • Path morphing on API +11 : 💪

RichPathAnimator.animate(richPath)

  .pathData(pathData1, pathData2, ...)

  .start();

Just 3 Steps to Animate any path.

1. In your layout.

 <com.richpath.RichPathView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:vector="@drawable/vector_drawable" />

2. Find your richPath.

// by path name RichPath richPath = richPathView.findRichPathByName("path_name");
 // or if it contains one path RichPath richPath = richPathView.findFirstRichPath();
 // or by index RichPath richPath = richPathView.findRichPathByIndex(0);

3. Use the RichPathAnimator to animate your richPath.

RichPathAnimator.animate(richPath)

  .trimPathEnd(value1, value2, ...)

  .fillColor(value1, value2, ...)

  .start();

Example

notification icon vector drawable

<vector xmlns:android="http://schemas.android.com/apk/res/android"
  android:width="32dp"
  android:height="32dp"
  android:viewportHeight="32.0"
  android:viewportWidth="32.0">

<group

android:pivotX="16"

android:pivotY="6.25">

<path

 android:name="top"

 android:fillColor="#FFF7F7F7"

 android:pathData="M22,19.8v-5c0-3.1-1.6-5.6-4.5-6.3V7.8c0-0.8-0.7-1.5-1.5-1.5s-1.5,0.7-1.5,1.5v0.7c-2.9,0.7-4.5,3.2-4.5,6.3v5l-2,2v1h16v-1L22,19.8z" />

 <path

 android:name="bottom"

 android:fillColor="#FFF7F7F7"

 android:pathData="M16,25.8c1.1,0,2-0.9,2-2h-4C14,24.9,14.9,25.8,16,25.8z" />
  </group> </vector> </vector>

XML

 <com.richpath.RichPathView

android:id="@+id/ic_notifications"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:vector="@drawable/ic_notifications" />

Java

RichPath top = notificationsRichPathView.findRichPathByName("top");
 RichPath bottom = notificationsRichPathView.findRichPathByName("bottom");
  RichPathAnimator.animate(top)

.interpolator(new DecelerateInterpolator())

.rotation(0, 20, -20, 10, -10, 5, -5, 2, -2, 0)

.duration(4000)

.andAnimate(bottom)

.interpolator(new DecelerateInterpolator())

.rotation(0, 10, -10, 5, -5, 2, -2, 0)

.startDelay(50)

.duration(4000)

.start();

Installation

Add the following dependency to your module build.gradle file:

dependencies {
  ...  compile 'com.github.tarek360.RichPath:animator:0.0.9' 
}

Add this to your root build.gradle file ( not your module build.gradle file) :

allprojects {
  repositories {

...
maven {
 url "https://jitpack.io" 
}
  
}
 
}

More Control by the RichPathAnimator

  • Animate multiple paths sequentially or at the same time
RichPathAnimator

  .animate(richPath1, richPath2)

  .rotation(value1, value2, ...)

//Animate the same path or another with different animated attributes.

  .andAnimate(richPath3)

  .scale(value1, value2, ...)

//Animate after the end of the last animation.

  .thenAnimate(richPath4)

  .strokeColor(value1, value2, ...)

// start your animation ????

  .start();

TODO

  • Clickable path (Done)
  • Support clip-path
  • Path animation (animate a RichPath on a path)
  • Reverse animation
  • ...

If you have any suggestion please open an issue for it.

Credits

  • florent37 He is the creator of ViewAnimator which gave me the idea of this project. Some core concepts and ideas were reused, but everything is written from scratch.
  • Android Some code is reused form the android source code and the VectorDrawableCompat support library.
  • Alex Lockwood The paths of the morphing sample is extracted from the Shape Shifter demo.

Developed By

License

Copyright 2017 Tarek360

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

Image selector for Android device. Support single choice and multi-choice.

This project aims to provide a working page flip implementation for usage in ListView.

An Android Wear Menu implementation.

It's a very simple custom views library according to UIButton of iOS, all of the views can be automatically set a pressed effect to a button with a simple background image without writing a selector.xml

Dagger2Scopes is a sample Android app to implement usual Dagger 1 multiple scoping logic with the brand new Dagger 2 Google lib. In this sample you will be able to find the following features:

  • Multiple scopes with Dagger 2 (Components and subcomponents).
  • An approach to Clean Architecture.
  • An approach to MVP pattern.

RxCupboard brings the excellent Android Cupboard library into the world of RxJava. Using a small set of convenience Observables, you can fluently store and retrieve streams of POJOs from your database.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes