lufy's legend

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 5123|回复: 0

关于graphics.add的使用问题

[复制链接]

7

主题

1

好友

211

积分

帐下督

Rank: 2

发表于 2021-8-13 11:30:32 |显示全部楼层
shape.graphics.add(function (ctx) {
    ctx.beginPath();
    ctx.moveTo(x0, y0);
    ctx.quadraticCurveTo(x1, y1, x2, y2);
    ctx.stroke();
})
我是用add绘制了一个贝塞尔曲线,其中(x0,y0)是起点,(x1,y1)是控制点,(x2,y2)是终点,发现在改变变量值后,曲线会实时改变,但是并没有写重新绘制的逻辑,于是我猜测,是不是add在实时绘制呢?还是说只是在变量改变的时候绘制呢,这是怎么一个原理呢?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

防止垃圾广告,请填写任意字符

Archiver|lufy's legend

GMT+8, 2024-3-29 22:41 , Processed in 0.047363 second(s), 23 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部