https://github.com/bikemap/AppleWatchSpriteKit
This is a sample project to shown how to use SpriteKit for animations on the Apple Watch. See the full explanation on Medium.
https://github.com/bikemap/AppleWatchSpriteKit
animation applewatch healthkit spritekit swift
Last synced: 3 months ago
JSON representation
This is a sample project to shown how to use SpriteKit for animations on the Apple Watch. See the full explanation on Medium.
- Host: GitHub
- URL: https://github.com/bikemap/AppleWatchSpriteKit
- Owner: bikemap
- Created: 2018-04-08T19:57:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-09T08:12:15.000Z (over 7 years ago)
- Last Synced: 2024-11-21T02:33:29.455Z (11 months ago)
- Topics: animation, applewatch, healthkit, spritekit, swift
- Language: Swift
- Homepage: https://medium.com/@eriadam/animations-on-apple-watch-with-spritekit-665b981e7b64
- Size: 28.3 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-apple-watch - Apple Watch + SpriteKit: Example Project
README
# Apple Watch + SpriteKit: Example Project
This is a sample project to shown how to use SpriteKit for animations on
the Apple Watch.
See the [full explanation on Medium](https://medium.com/@eriadam/animations-on-apple-watch-with-spritekit-665b981e7b64).**1. Watch Extension: InterfaceController**
Create an IBOutlet for the SpriteKit scene. It has to be of type
WKInterfaceSKScene.**2. Watch: Assets**
Add the different resolutions of the heart image to your Assets folder.
**3. Watch Extension: SpriteKit Scene**
Add a new SpriteKit scene to the extension target. Add an SKSpriteNode to the
scene and set the texture to the heart image.**4. SpriteKit Scene: Animations**
For the animation we added scaleTo actions to the sprite node. One for
enlarging, one for shrinking, then a pause, with a total duration of 1 second.
Then an infinite loop is created from these actions.**5. Watch: Interface.storyboard**
Add a SpriteKit scene to the storyboard and connect it to the IBOutlet.
Set the scene property to the one you created above. Make sure the isPaused
property is not checked, so the animation is started as soon the scene appears
on the screen.