Search in sources :

Example 41 with PathMeasure

use of android.graphics.PathMeasure in project LoadingDrawable by dinuscxj.

the class CircleBroodLoadingRenderer method getRestLength.

private float getRestLength(Path path, float startD) {
    Path tempPath = new Path();
    PathMeasure pathMeasure = new PathMeasure(path, false);
    pathMeasure.getSegment(startD, pathMeasure.getLength(), tempPath, true);
    pathMeasure.setPath(tempPath, false);
    return pathMeasure.getLength();
}
Also used : Path(android.graphics.Path) PathMeasure(android.graphics.PathMeasure)

Example 42 with PathMeasure

use of android.graphics.PathMeasure in project FloatingView by UFreedom.

the class FloatingPath method create.

public static FloatingPath create(Path path, boolean forceClose) {
    FloatingPath floatingPath = new FloatingPath(path);
    floatingPath.mPathMeasure = new PathMeasure(path, forceClose);
    return floatingPath;
}
Also used : PathMeasure(android.graphics.PathMeasure)

Example 43 with PathMeasure

use of android.graphics.PathMeasure in project Transitions-Everywhere by andkulikov.

the class PathAnimatorCompat method ofPointF.

@Nullable
public static <T> PathAnimatorCompat ofPointF(@Nullable T target, @Nullable PointFProperty<T> property, @Nullable Path path) {
    PathAnimatorCompat animator = null;
    if (target != null && property != null && path != null) {
        animator = new PathAnimatorCompat(target, property);
        animator.mPathMeasure = new PathMeasure(path, false);
        animator.mPathLength = animator.mPathMeasure.getLength();
    }
    return animator;
}
Also used : PathMeasure(android.graphics.PathMeasure) Nullable(android.support.annotation.Nullable)

Example 44 with PathMeasure

use of android.graphics.PathMeasure in project MaterialCalendar by Haoxiqiang.

the class WeatherTemplateView method getPoints.

protected PathPoints[] getPoints(Path path, int size) {
    // Size of 100 indicates that, 100 points
    // would be extracted from the path
    PathPoints[] pointArray = new PathPoints[size];
    PathMeasure pm = new PathMeasure(path, false);
    float length = pm.getLength();
    float distance = 0f;
    float speed = length / size;
    int counter = 0;
    float[] aCoordinates = new float[2];
    while ((distance < length) && (counter < size)) {
        pm.getPosTan(distance, aCoordinates, null);
        pointArray[counter] = new PathPoints(aCoordinates[0], aCoordinates[1]);
        counter++;
        distance = distance + speed;
    }
    return pointArray;
}
Also used : PathMeasure(android.graphics.PathMeasure) Paint(android.graphics.Paint)

Example 45 with PathMeasure

use of android.graphics.PathMeasure in project YhLibraryForAndroid by android-coco.

the class LineChartView method setAnim.

// 设置动画
private void setAnim(Canvas canvas) {
    PathMeasure measure = new PathMeasure(mPath, false);
    float pathLength = measure.getLength();
    PathEffect effect = new DashPathEffect(new float[] { pathLength, pathLength }, pathLength - pathLength * mProgress);
    mPaintLine.setPathEffect(effect);
    canvas.drawPath(mPath, mPaintLine);
}
Also used : PathMeasure(android.graphics.PathMeasure) DashPathEffect(android.graphics.DashPathEffect) PathEffect(android.graphics.PathEffect) DashPathEffect(android.graphics.DashPathEffect)

Aggregations

PathMeasure (android.graphics.PathMeasure)48 Path (android.graphics.Path)18 Paint (android.graphics.Paint)11 RectF (android.graphics.RectF)5 Point (android.graphics.Point)3 ParseException (java.text.ParseException)3 Animator (android.animation.Animator)2 AnimatorSet (android.animation.AnimatorSet)2 ObjectAnimator (android.animation.ObjectAnimator)2 PropertyValuesHolder (android.animation.PropertyValuesHolder)2 ValueAnimator (android.animation.ValueAnimator)2 SuppressLint (android.annotation.SuppressLint)2 TargetApi (android.annotation.TargetApi)2 Matrix (android.graphics.Matrix)2 PointF (android.graphics.PointF)2 Rect (android.graphics.Rect)2 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 DashPathEffect (android.graphics.DashPathEffect)1 PathEffect (android.graphics.PathEffect)1 Nullable (android.support.annotation.Nullable)1