圆点抖动问题#37
Open
stefenson wants to merge 5 commits into
Open
Conversation
Owner
|
你不 build 一下,怎么知道是不是生效的? |
Author
|
主要是不知道怎么Build……233 我对js项目真的不太熟悉……改动的地方应该是都进去了,应该不会有问题 ^_^|| |
Owner
然后打开 index.html 就可以测试了! 我来帮你测试下吧! |
Owner
|
测试过了,直接爆炸了,小点的移动速度很快。感觉是加速度错了! |
Author
|
又提交了一下,刚刚点重绘的位置不对,放到里层for循环了,所以才炸了Orz |
Author
|
测试了一下应该没问题了~ |
Owner
|
感觉上还是有点问题,最后形成圈很慢,我还没有能理解你的代码思路。 |
Author
|
嗯,是还有问题,主要是没有考虑两个速度分量应该怎么分配 简单来说现在的加速度变化只取决于点到中心距离关于max/2的比例,然后用这个系数同时处理纵向和横向的加速度,加速度与速度方向关系是如果下一秒点要向外部移动那么就是反的否则是正的。 但其实这样是不对的,只是近似处理成了飞向中心时加速,远离中心时减速的效果。 减速的速度偏移与点到中心的距离有关。 基本思路是这样的。 |
|
圆点的颜色,为什么修改了源码却不生效啊??? |
laine001
reviewed
Oct 31, 2018
| r.y += r.ya; // 移动 | ||
| r.xa *= r.x > width || r.x < 0 ? -1 : 1; | ||
| r.ya *= r.y > height || r.y < 0 ? -1 : 1; // 碰到边界,反向反弹 | ||
| context.fillRect(r.x - 0.5, r.y - 0.5, 1, 1); // 绘制一个宽高为1的点 |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2
只改了src里面的CanvasNest.js,dist目录跟lib目录不知道是干啥的就没动……
原谅我js写的少Orz……