如何动画线条绘制在iPhone开发? [英] How to animate line-drawing in iPhone development?

查看:127
本文介绍了如何动画线条绘制在iPhone开发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找身边,但似乎对于这个简单的问题没有很好的答案。所以我再次问:如何动画线图中的iPhone开发

I have been searching around, but there seems no good answer for this simple question. So I am asking again: how to animate line-drawing in iphone dev?

基本上我想是这样的:

@implementation MyUIView

- (void) triggerLineDrawing: (CGPathRef) path {
   ...
   // animate line drawing here
   // and the line should disappear automatically after a few seconds
}

能不能做到?

推荐答案

您无法自动做到这一点,只有卜手。做手工,你应该做这样的事情:

You can't do it automatically, only bu hand. To do it manually you should do something like this:


  • 创建您的点线阵。

  • 启动的NSTimer,这将触发例如15次。

  • 定时器的每个替你找出来了,你所需要的部分线路绘制(看线性插值)

  • 你画(只需要的即点移动+最后一点)
  • 更新路径
  • 发送setNeedsDraw信息进行查看。

您可以改变插值algorythm,白描等的速度来获得你需要的效果。

You can vary interpolation algorythm, speed of line drawing etc. to get the effect that you need.

这篇关于如何动画线条绘制在iPhone开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆