【问题标题】:Animating frame Images with ease effect on iPad在 iPad 上轻松制作动画帧图像
【发布时间】:2011-11-18 05:51:36
【问题描述】:

让我向您展示示例(360 度 3D 对象旋转器):
演示:http://activeden.net/item/interactive-renders-360-deg-3d-object-rotator/39718?ref=mixDesign


如您所见,有一个相机 3D 在鼠标事件上旋转。实际上,它是根据鼠标事件逐帧动画的图像(帧)集合。

我想用 objective - c 使用 滑动手势 来实现这个动画(或者我应该使用其他手势?)。这样我就可以用手指旋转,向向左,向向右(我想要具有平滑缓动效果的动画,具体取决于滑动速度速度)。

注意:我已经为每一帧准备好了图片。

示例代码、在线教程对我很有帮助。

!我应该使用一些外部图形库来保持性能吗?我有数百张图片 (PNG),每张大小为 300kb

提前谢谢你,我真的需要你的帮助!

【问题讨论】:

    标签: objective-c ios ipad easing rotator


    【解决方案1】:

    也许在这里使用touchesBegan:touchesMoved:touchesEnded: 会更容易?这将使您能够非常快速地对速度和方向变化做出反应。

    更新:可以在here找到示例。

    【讨论】:

      【解决方案2】:

      我认为您不应该在这里使用滑动手势。我建议您使用具有较短 minimumPressDuration 的 LongPressGesture。

      让我展示示例代码:

      longPress = [ [UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGesture:)] 
      longPress.delegate = self;
      longPress.minimumPressDuration = 0.05;
      [viewWithImage addGestureRecognizer:longPress];
      
      
      float startX; 
      float displacement = 0;
      -(IBAction)handleLongPressGesture:(UILongPressGestureRecognizer *)sender
      {   
      
      float nowX;
          if ( sender.state == UIGestureRecognizerStateBegan ) 
          {
              startX = [sender locationInView:viewWithImage].x;
          }
          if ( sender.state == UIGestureRecognizerStateEnded || sender.state == UIGestureRecognizerStateCancelled)
          {
             ... do something at end ... 
          }
      nowX = [sender locationInView:mainWidgetView].x;
      displacement = nowX - startX; 
      
        // set right rotation with displacement value
        [self rotateImageWith:displacement];
      }
      

      【讨论】:

        猜你喜欢
        • 2012-02-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-03-01
        • 1970-01-01
        • 2016-02-17
        • 2014-10-02
        • 2016-04-21
        相关资源
        最近更新 更多