objective-c - 在iPad上轻松制作动画帧图像

标签 objective-c ios ipad easing rotator

让我向您展示示例(360度3D对象旋转器):演示:http://activeden.net/item/interactive-renders-360-deg-3d-object-rotator/39718?ref=mixDesign
如您所见,有一个3D鼠标事件旋转的相机。实际上,它是图像(帧)的集合,根据鼠标事件逐帧进行动画处理。
我想使用目标实现此动画-使用滑动手势(或者我应该使用其他手势)来实现。这样我就可以用手指旋转,向左,向右(我希望动画具有平滑的缓动效果,具体取决于滑动速度speed )。
注意:我已经准备好每帧图像。

样例代码,执行此操作的在线教程将对我有很大帮助。
!为了保持性能,是否应该使用一些外部图形库?我有数百张图片(PNG),每张图片的大小为300kb
预先谢谢您,我真的需要您的帮助!

最佳答案

我认为您不应该在这里使用滑动手势。我建议您使用shortMiniPressDuration较短的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];
}

关于objective-c - 在iPad上轻松制作动画帧图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8178316/

相关文章:

ios - 在 iOS 中使用 MPMusicPlayerController 播放和跳过播放列表中的下一首歌曲

ios - 动态 Tableviewcell 中的按钮不可点击

ios - 更新 UICollectionViewCell 中的渐变

Objective-C:只有数字的文本字段?

ios - 类型 'UnsafeMutableRawPointer' 的值没有下标 Swift 5

objective-c - 当“重复次数”设置为"is"时,cheduledTimerWithTimeInterval仅触发一次

Objective-C 描述的行为不符合我的预期。

javascript - 带有溢出自动/滚动的 jQuery scrollTop 动画

html - 滑过图像时图像显示为 'shear'

ios - Objective-C try-catch - 为什么编译?为什么返回不同的构建调试与发布?