Latest | 1.1.1 |
---|---|
Homepage | https://github.com/maxxfrazer/SceneKit-Bezier-Animations |
License | MIT |
Platforms | ios 11.0 |
SceneKit-Bezier-Animations
I noticed that there was no nice way (to my knowledge) in SceneKit of animating a Node along a curved path.
Include this pod in your project:
pod 'SCNBezier'
Using this framework you can animate a Node along a bézier path using the following example code:
let myNode = SCNNode(geometry: SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0))
let bezPositions = [SCNVector3(-1, 1, 0.01),
SCNVector3(1, 0.5, 0.4),
SCNVector3(1.0, -1, 0.1),
SCNVector3(0.4, -0.5, 0.01)]
myNode.runAction(SCNAction.moveAlong(points: bezPositions, duration: 3, fps: 12))
The animation will use duration * fps
points to animated between. This does not mean it will not be smooth, it just means it will make the curve out of that many points, so in this example it will use 36 points along the bézier curve.
Latest podspec
{ "name": "SCNBezier", "version": "1.1.1", "summary": "SCNBezier allows users to animate objects along 3D bu00e9zier curves.", "description": "SCNBezier allows users to animate objects along bu00e9zier curves.nAny number of points can be used for the bu00e9zier curves, not limited to just quadratic or cubic", "homepage": "https://github.com/maxxfrazer/SceneKit-Bezier-Animations", "license": "MIT", "authors": "Max Cobb", "source": { "git": "https://github.com/maxxfrazer/SceneKit-Bezier-Animations.git", "tag": "1.1.1" }, "swift_version": "4.1", "platforms": { "ios": "11.0" }, "source_files": "SCNBezier/SCNBezier/*.swift" }
Thu, 29 Nov 2018 11:12:10 +0000