All Projects → maxxfrazer → Scenekit Bezier Animations

maxxfrazer / Scenekit Bezier Animations

Licence: mit
Create animations over Bezier curves of any number of points

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Scenekit Bezier Animations

Scenekit Scnline
Draw a tube or thick line in SceneKit
Stars: ✭ 49 (+40%)
Mutual labels:  swift-package-manager, swiftpm, arkit, scenekit
Dtphotoviewercontroller
A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.
Stars: ✭ 212 (+505.71%)
Mutual labels:  cocoapods, swift-package-manager, cocoapod
Swipycell
Easy to use UITableViewCell implementing swiping to trigger actions.
Stars: ✭ 230 (+557.14%)
Mutual labels:  cocoapods, swift-package-manager, swiftpm
Dikit
Dependency Injection Framework for Swift, inspired by KOIN.
Stars: ✭ 77 (+120%)
Mutual labels:  cocoapods, swift-package-manager, swiftpm
Realityui
A Swift Package for creating familiar UI Elements and animations in a RealityKit rendered Augmented Reality or Virtual Reality scene.
Stars: ✭ 275 (+685.71%)
Mutual labels:  swift-package-manager, swiftpm, arkit
Sablurimageview
You can use blur effect and it's animation easily to call only two methods.
Stars: ✭ 538 (+1437.14%)
Mutual labels:  cocoapods, swift-package-manager
Arsolarplay
通过ARKit实现的太阳系动画
Stars: ✭ 593 (+1594.29%)
Mutual labels:  arkit, scenekit
Arpaint
Draw with bare fingers in the air using ARKit
Stars: ✭ 672 (+1820%)
Mutual labels:  arkit, scenekit
Statusalert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Stars: ✭ 809 (+2211.43%)
Mutual labels:  cocoapods, swift-package-manager
Arkit Emperor
Power! Unlimited power for ARKit 2.0!
Stars: ✭ 464 (+1225.71%)
Mutual labels:  arkit, scenekit
Zephyr
Effortlessly synchronize UserDefaults over iCloud.
Stars: ✭ 722 (+1962.86%)
Mutual labels:  cocoapods, swift-package-manager
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-11.43%)
Mutual labels:  cocoapods, swift-package-manager
Swiftframeworktemplate
A template for new Swift iOS / macOS / tvOS / watchOS Framework project ready with travis-ci, cocoapods, Carthage, SwiftPM and a Readme file
Stars: ✭ 527 (+1405.71%)
Mutual labels:  cocoapods, swift-package-manager
Openssl
OpenSSL package for SPM, CocoaPod, and Carthage, for iOS and macOS
Stars: ✭ 515 (+1371.43%)
Mutual labels:  cocoapods, swift-package-manager
Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (+1731.43%)
Mutual labels:  cocoapods, swift-package-manager
Keyboardshortcuts
Add user-customizable global keyboard shortcuts to your macOS app in minutes
Stars: ✭ 500 (+1328.57%)
Mutual labels:  cocoapods, swift-package-manager
Defaults
Swifty and modern UserDefaults
Stars: ✭ 734 (+1997.14%)
Mutual labels:  cocoapods, swift-package-manager
Arpointcloud
A Basic Example Of Visualising Point Clouds In ARKit
Stars: ✭ 31 (-11.43%)
Mutual labels:  arkit, scenekit
Taniwhatextfield
My first cocoapod framework
Stars: ✭ 26 (-25.71%)
Mutual labels:  cocoapods, swift-package-manager
Imagescout
A Swift implementation of fastimage. Supports PNG, GIF, and JPEG.
Stars: ✭ 940 (+2585.71%)
Mutual labels:  cocoapods, swiftpm

SceneKit-Bezier-Animations

Animate a SCNNode along a curved path in SceneKit.

Linter Status Build Status

License Platform SwiftPM Swift 5.0


Installation

Swift Package Manager

Add the URL of this repository to Xcode 11 with minimum version 1.3.0

Cocoapods

Add the following to your Podfile pod 'SCNBezier'


Usage

Animating

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 requires type Double, or its TypeAlias TimeInterval. 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.

Getting a Bézier curve

The class SCNBezierPath can be created if you want to collect n points along a path for positioning objects etc. as such:

let path = SCNBezierPath(points: points)
for point in path.getNPoints(count: 20) {
	let newNode = SCNNode(geometry: nodeGeometry)
	newNode.position = point
	parent.addChildNode(newNode)
}

Position on a Bézier curve

If you want to get a point some percentage along the curve, there's a function that makes that easy for you too.

let path = SCNBezierPath(points: points)
let quaterWay = path.posAt(time: 0.25) // gets the point 25% along from start to end

With points, nodeGeometry and parent being arbitrary values.


Bézier example

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].