我想展示一个落块的效果,这些落块在一些下落动画后落在预定的位置上。不使用物理引擎可以做到这一点吗?
发布于 2011-03-08 03:09:38
通过使用CCJumpTo操作,我在cocos2d中找到了一种更好、更简单的方法
CCActionInterval *jump1 = [CCJumpTo actionWithDuration:3 position:sp.position height:150 jumps:2];
sp.position = ccp(10,100);
[sp runAction:jump1];其中sp是数据块的CCSprite。
发布于 2011-03-07 18:30:30
你所需要的就是模拟重力,物体的加速度。这可以通过自定义动画曲线很容易地实现。请看这个QA "how-to-create-custom-easing-function-with-core-animation",它展示了一种创建所需曲线的方法。在这里,is some more about "Animation Types Timing" by Apple。
您正在寻找的函数名为functionWithControlPoints,它有四个输入参数,所以您可以使用自定义曲线放入任何您希望的随机元素。
发布于 2012-01-09 04:39:40
“轻松”是你的答案。您可以从下面的链接中选择所需的可视化方法。
Tim Groleau's easing generator
jQuery Easing Demos
https://stackoverflow.com/questions/5218389
复制相似问题