private Button createMaterialMotionButton(String label,
            final float cx1, final float cy1, final float cx2, final float cy2,
            float weight, final ControlPointCallback callback) {
        Button button = new Button(this);
        LayoutParams params = new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.weight = weight;
        button.setLayoutParams(params);
        button.setText("F out L in");
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // Animate the control points to their new values
                final float oldCx1 = mVisualizer.getCx1();
                final float oldCy1 = mVisualizer.getCy1();
                final float oldCx2 = mVisualizer.getCx2();
                final float oldCy2 = mVisualizer.getCy2();
                ValueAnimator anim = ValueAnimator.ofFloat(0, 1).setDuration(100);
                anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                    @Override
                    public void onAnimationUpdate(ValueAnimator valueAnimator) {
                        float t = valueAnimator.getAnimatedFraction();
                        mVisualizer.setCubicInterpolator(oldCx1 + t * (cx1 - oldCx1),
                                oldCy1 + t * (cy1 - oldCy1),
                                oldCx2 + t * (cx2 - oldCx2),
                                oldCy2 + t * (cy2 - oldCy2), callback);
                    }
                });
                anim.start();
            }
        });
        return button;
    }
Creates a cubic PathInterpolator, whose control points values can be changed
by the user dragging the handles around in the UI.
AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java