SpriteKitEasingSwift 0.10

SpriteKitEasingSwift 0.10

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2016
SPMSupports SPM

Maintained by Craig Grummitt.


Downloads

Total3,105
Week64
Month294

Installs

Apps92
Apps WeekApps This Week 10
Test Targets5
powered by Segment

GitHub

Stars52
Watchers6
Forks13
Issues1
Contributors6
Pull Requests0

Code

Files3
LOCLines of Code 378


  • By
  • Craig Grummitt

SpriteKitEasingSwift

Better Easing for SpriteKit in Swift

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.

  • Linear
  • Quadratic
  • Cubic
  • Quartic
  • Quintic
  • Sine
  • Circular
  • Expo
  • Elastic
  • Back
  • Bounce

easing.gif

The 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.

//eg an SKLabelNode(which extends SKNode) flies in from the right with an elastic tween:
let titleLabel = SKLabelNode(fontNamed:"Avenir-Light")
titleLabel.text = "Hello world"
titleLabel.fontSize = 65
titleLabel.fontColor = UIColor.blackColor()
titleLabel.position = CGPoint(x:CGRectGetMidX(self.frame), y:CGRectGetMidY(self.frame))
self.addChild(titleLabel)
titleLabel.runAction(SKEase.moveFrom(withNode:titleLabel, easeFunction: .CurveTypeElastic, easeType: .EaseTypeOut, time: 1.5, fromVector: CGVectorMake(frame.width+titleLabel.frame.width/2, titleLabel.position.y)))

Again, credit and thanks go to SpriteKitEasing and AHEasing.

API documentation can be found at cocoadocs.

Installation

via CocoaPods

SpriteKitEasingSwift is available through CocoaPods. To install it, add the following to your Podfile: (Static Swift frameworks require iOS 8)

platform :ios, '8.0'
use_frameworks!

target "MyApp" do
    pod 'SpriteKitEasingSwift'
end

Don’t forget to import the Pod where you would like to use it:

import SpriteKitEasingSwift

via Carthage

Don’t forget to import the Pod where you would like to use it:

import SpriteKitEasingSwift

via Github:

Clone the project at Github (https://github.com/craiggrummitt/SpriteKitEasingSwift). You will find an example project there as well. To use the framework either:

  1. Drag the Pod/Classes folder into your project.
  2. Import the frameworks in the _Archive folder. Follow the steps under ‘Adding Frameworks to an App’ here.