How to change the frame rate of a core animation i

2019-05-23 12:15发布

Take CABasicAnimation for example. How do you lower the frame rate (overhead)? Animations run smooth, but my touchesMoved method skips a beat. Want to reduce the animation frame rate so touchesMoved is not skipping movements.

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-05-23 12:44

You don't have any inherent control over frame rate once you start your CABasicAnimation.

Probably the best way to achieve this would be to create multiple interpolations for a single animation (i.e. if you're moving 50 px down and 50px across, do 2 x 25px each) and induce an artificial sleep in your thread. Not a perfect solution, but will perhaps achieve slightly better results that you're seeing.

Be aware that this technique will have different framerates on different CPUs, and is therefore not generally recommended. Essentially, YMMV.

查看更多
登录 后发表回答