Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/craiggrummitt/SpriteKitEasingSwift
Better Easing for SpriteKit in Swift
https://github.com/craiggrummitt/SpriteKitEasingSwift
Last synced: about 1 month ago
JSON representation
Better Easing for SpriteKit in Swift
- Host: GitHub
- URL: https://github.com/craiggrummitt/SpriteKitEasingSwift
- Owner: craiggrummitt
- License: mit
- Created: 2014-08-08T17:23:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T16:05:49.000Z (over 3 years ago)
- Last Synced: 2024-10-04T04:03:54.732Z (2 months ago)
- Language: Swift
- Homepage: http://craiggrummitt.com/2014/08/08/easing-equations-in-swift/
- Size: 2.15 MB
- Stars: 115
- Watchers: 11
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - SpriteKitEasingSwift - Better Easing for SpriteKit. (Libs / Animation)
- awesome-swift - SpriteKitEasingSwift - Better Easing for SpriteKit. (Libs / Animation)
- awesome-swift - SpriteKitEasingSwift - Better Easing for SpriteKit in Swift ` 📝 3 years ago ` (Animation [🔝](#readme))
- awesome-swift - SpriteKitEasingSwift - Better Easing for SpriteKit. (Libs / Animation)
README
![SpriteKitEasingSwift: Better Easing for SpriteKit in Swift. ](SpriteKitEasingSwift.png)
[![CI Status](http://img.shields.io/travis/[email protected]/SpriteKitEasingSwift.svg?style=flat)](https://travis-ci.org/[email protected]/SpriteKitEasingSwift)
[![Version](https://img.shields.io/cocoapods/v/SpriteKitEasingSwift.svg?style=flat)](http://cocoapods.org/pods/SpriteKitEasingSwift)
[![License](https://img.shields.io/cocoapods/l/SpriteKitEasingSwift.svg?style=flat)](http://cocoapods.org/pods/SpriteKitEasingSwift)
[![Platform](https://img.shields.io/cocoapods/p/SpriteKitEasingSwift.svg?style=flat)](http://cocoapods.org/pods/SpriteKitEasingSwift)This easing library began life as a port of buddingmonkey's Objective C SpriteKit Easing library to Swift.
This library extends upon the basic easing equations available in the SpriteKit framework by Apple.
Sprite Kit Easing makes available the following standard easing equations as SKActions.
![easing.gif](easing.gif)
Use SKEase methods to tween properties of an SKNode, such as:
* move
* scale
* scaleX
* scaleY
* rotate
* fade
* tweenLabelColor
* tweenShapeFillColorIf you want to tween a variable, use:
* createPointTween
* createFloatTween
* createColorTweenThe SKEase functions return an SKAction that performs the ease. You can then run the SKAction in the same manner you would any other SKAction in SpriteKit.
```Swift
//eg an SKLabelNode(which extends SKNode) flies in from the right with an elastic tween:
//first create an SKNode, let's create a label node
let titleLabel = SKLabelNode(fontNamed:"Avenir-Light")
titleLabel.text = "Hello world"
titleLabel.fontSize = 65
titleLabel.fontColor = UIColor.white
titleLabel.position = CGPoint(x:self.frame.midX, y:self.frame.midY)
self.addChild(titleLabel)
//perform elastic ease
titleLabel.run(SKEase.move(easeFunction: .curveTypeElastic,
easeType: .easeTypeOut,
time: 2,
from: CGPoint(x: frame.width+titleLabel.frame.width/2, y: titleLabel.position.y),
to:CGPoint(x: -titleLabel.frame.width/2, y: titleLabel.position.y)))
```## Installation
**via CocoaPods**
SpriteKitEasingSwift is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'SpriteKitEasingSwift'
```To run the example project, clone the repo, and run `pod install` from the Example directory first.
Don't forget to import the Pod where you would like to use it:
```Swift
import SpriteKitEasingSwift
```***via Github:***
Clone the project at Github ([https://github.com/craiggrummitt/SpriteKitEasingSwift](https://github.com/craiggrummitt/SpriteKitEasingSwift)). You will find an example project there as well. To use the framework drag the SpriteKitEasingSwift/Classes folder to your project.
## Author
Again, credit and thanks go to SpriteKitEasing and AHEasing and the legend of easing, Robert Penner.
## License
SpriteKitEasingSwift is available under the MIT license. See the LICENSE file for more info.