从拍摄的真实物体360度旋转物体

我想创造360度旋转拍摄对象的能力。

  • 它根据你“轻弹”的速度无休止地旋转。
  • 通过向左或向右轻拂物体左右旋转。
  • 当你触摸时停止旋转,如果它正在旋转,就停止旋转。

在这里输入图像说明

类似于Theodore Gray的应用程序。

以下是我正在尝试重新创build的部分应用的video。 (即3D旋转器)

这是我的手指与它交互的video。

https://youtu.be/qjzeewpVN9o

我正在寻找使用Swift和可能的SpriteKit。

  1. 我如何才能从真实的生活中获得高质量和function性的东西? 我配备了一台Mac,尼康D810和一个绿色屏幕。

    也就是说,我猜测,一系列的静止图像是要走的路,但我觉得可能不够stream畅。

    为了这个问题的目的,我想弄清楚什么是最有意义的编程。 例如,我正在倒带和快速转发的video或停止运动帧的纹理图集等。

    注意:捕捉软件和摄影技术将是有用的信息,因为我在这个部门无能为力。 但是,我知道我可以在https://photo.stackexchange.com/上提问。


  1. 我的代码的基本逻辑是什么样的这个对象? 就……而言:

答:设置对象的animation或video的function,或者是让我的代码中使用图像的最佳方法。

B.旋转()函数和

C. stopSpin()函数。

整个项目样本是不需要的(虽然我猜这会很好)。 但是,这3个function足以让我去。


  1. SpriteKit是最明智的select吗?

这里是我的答案的第二稿,展示了一个简单的精灵animation的基本function:

class GameScene: SKScene { // Left spin is ascending indices, right spin is descending indices. var initialTextures = [SKTexture]() // Reset then reload this from 0-6 with the correct image sequences from initialTextures: var nextTextures = [SKTexture]() var sprite = SKSpriteNode() // Use gesture recognizer or other means to set how fast the spin should be. var velocity = TimeInterval(0.1) enum Direction { case left, right } func spin(direction: Direction, timePerFrame: TimeInterval) { nextTextures = [] for _ in 0...6 { var index = initialTextures.index(of: sprite.texture!) // Left is ascending, right is descending: switch direction { case .left: if index == (initialTextures.count - 1) { index = 0 } else { index! += 1 } case .right: if index == 0 { index = (initialTextures.count - 1) } else { index! -= 1 } } let nextTexture = initialTextures[index!] nextTextures.append(nextTexture) sprite.texture = nextTexture } let action = SKAction.repeatForever(.animate(with: nextTextures, timePerFrame: timePerFrame)) sprite.run(action) } override func didMove(to view: SKView) { removeAllChildren() // Make our textures for spinning: for i in 0...6 { initialTextures.append(SKTexture(imageNamed: "img_\(i)")) } nextTextures = initialTextures sprite.texture = nextTextures.first! sprite.size = nextTextures.first!.size() addChild(sprite) spin(direction: .left, timePerFrame: 0.10) } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { spin(direction: .right, timePerFrame: velocity) } override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { spin(direction: .left, timePerFrame: velocity) } } 

现在你只需点击/释放左侧替代。

Todo下一稿:
– 为速度实现手势识别器
– 如果想要实现衰减(所以它会随着时间的推移而减速)

(旧video,新代码不会将帧重置为0):

在这里输入图像说明

图片资源可以在这里findanimation: https : //drive.google.com/open?id = 0B3OoSBYuhlkgaGRtbERfbHVWb28