Skip to content

Including a light PathParser tool and animated PathView for Android, which is based on vector.

License

Notifications You must be signed in to change notification settings

huzenan/EasyPath

Repository files navigation

EasyPath

Including a light PathParser tool and animated PathView for Android, which is based on vector. PathParser is easy to EXTEND, welcome and have fun!

ScreenShots

Icons

icon1

icon2

Separate

EasyPathSeparate

Together

EasyPathTogether

Dynamic&Repeat

EasyPathRepeat

Gradle

Add to your root build.gradle:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency:

dependencies {
    compile 'com.github.huzenan:EasyPath:v1.0.2'
}

Usage

Step 1

Define your path string like this:

    <string name="path_string_android">
        m100,300    c130,20,470,20,500,300    m500,300
            l500,525  100,525  100,300  500,300
                m200,180  o215,180,10,1    m400,180  o385,180,10,2
                    m200,105  l175,75    m400,105  l425,75
    </string>

Step 2

layout

    <com.hzn.lib.EasyPathView
        android:id="@+id/easy_path_view"
        android:layout_width="50dp"
        android:layout_height="50dp"
        custom:epvAnimDurations="250,350,150,150,150,150"
        custom:epvAnimMode="separate"
        custom:epvDynamic="false"
        custom:epvFixedHeight="600"
        custom:epvFixedWidth="600"
        custom:epvPathString="@string/path_string_android"
        custom:epvState="show"
        custom:epvStrokeColor="#09991c"
        custom:epvStrokeFixedWidth="20"
        custom:epvStrokeIsRound="true"/>

Activity

    easyPathView.starDraw(true); // true if repeat
    ...
    easyPathView.starErase();
    ...
    easyPathView.stopRepeat();
    ...
    easyPathView.setAnimProgress(0.66f);
    ...
    easyPathView.addOnAnimatorListener(new EasyPathView.OnAnimatorListener() {
        @Override
        protected void onAnimStart(int state) {
            // your codes
        }
        
        @Override
        protected void onAnimEnd(int state) {
            // your codes
        }
        
        @Override
        protected void onAnimRepeat(int state) {
            // your codes
        }
    });

About

Including a light PathParser tool and animated PathView for Android, which is based on vector.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages