Code example for PathMeasure

Methods: getLength, getSegment, setPath

0
            setGoal(goal.add(vel.normed().scale(10)));
        } 
 
        private Path tailPath() {
            Path result = new Path();
            pathMeasure.setPath(path, false);
            pathMeasure.getSegment(0, 0.95f*pathMeasure.getLength(),
                                   result, true);
            return result;
        } 
 
        // public Rect headRect() { 
        //     Rect result = new Rect((int)pos.x, (int)pos.y, 
        //                            (int)pos.x, (int)pos.y); 
        //     result.inset(-(int)width, -(int)width); 
        //     return result; 
        // } 
 
        public void vibrate() { 
            long now = System.currentTimeMillis();
            if (now - last_vibrate_time > 150)