把玩PathInterpolator

把玩PathInterpolator标签(空格分隔): Android最近发现一个有意思的插值器PathInterpolator,传一个或两个点进去就可当插值器使用。可以看一下两个构造函数,生成的path是一个贝赛尔曲线。 /*** Create an interpolator for a quadratic Bezier curve. The end points* (0, 0)<
摘要由CSDN通过智能技术生成

最近发现一个有意思的插值器PathInterpolator,传一个或两个点进去就可当插值器使用。可以看一下两个构造函数,生成的path是一个贝赛尔曲线

 /**
* Create an interpolator for a quadratic Bezier curve. The end points
* <code>(0, 0)</code> and <code>(1, 1)</code> are assumed.
*
* @param controlX The x coordinate of the quadratic Bezier control point.
* @param controlY The y coordinate of the quadratic Bezier control point.
*/
public PathInterpolator(float controlX, float controlY) {
    initQuad(controlX, controlY);
}

/**
* Create an interpolator for a cubic Bezier curve.  The end points
* <code>(0, 0)</code> and <code>(1, 1)</code> are assumed.
*
* @param controlX1 The x coordinate of the first control point of the cubic Bezier.
* @param controlY1 The y coordinate of the first control point of the cubic Bezier.
* @param controlX2 The x coordinate of the second control point of the cubic Bezier.
* @param controlY2 The y coordinate of the second control point of the cubic Bezier.
*/
public PathInterpolator(float controlX1, float controlY1, float controlX2, float controlY2) {
    initCubic(controlX1, controlY1, controlX2, controlY2);
}

private void initQuad(float controlX, float controlY) {
    Path path = new Path();
    path.moveTo(0, 0);
    path.quadTo(controlX, controlY, 1f, 1f);
    initPath(path);
}

private void initCubic(
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值