Latest 0.1.1
Homepage https://github.com/edwinveger/SCKTEffects
License MIT
Platforms ios 8.0
Authors

SCKTEffects

CocoaPods Compatible

A collection of SpriteKit and SceneKit animation helper classes, written in Swift.

It is based on SKTUtils, which was originally written for the book iOS Games by Tutorials, Second Edition, which is published through raywenderlich.com.

Introducting SCKTEffects

SCKTEffects is based on SKTEffects (which is part of SKTUtils). It allows you to run translate, rotate and scale actions in Sprite Kit and Scene Kit using custom timing functions.

Note: The iOS 8 version of Sprite Kit includes an SKAction.timingFunction property, but unfortunately it is pretty useless. It’s a step in the right direction, but it still won’t let you perform the kinds of effects that make games juicy.

The only reason SKTEffects exists is because SKAction does not allow arbitrary timing functions, only standard ease-in and ease-out. The SKTEffect subclasses are re-implementations of what SKAction already does but with the addition of custom timing functions.

What can SCKTEffects do for you?

Custom timing functions for animations! There are currently three SKTEffect subclasses:

  • SKTMoveEffect
  • SKTRotateEffect
  • SKTScaleEffect

You typically don’t include SCKTEffectsCore directly, but instead one of the pods below.

SCKTEffectSpriteKit

CocoaPods Compatible

import SCKTEffectsSpriteKit

let node = SKNode()

let effect = node.moveEffect()
    .withDuration(1.5)
    .using(SKTTimingFunction.elasticEaseOut)
    .ending(at: CGPoint(x: size.width / 2, y: size.height / 2))

node.run(effect.asAction())

Podfile

To integrate SCKTEffectSpriteKit into your Xcode project using CocoaPods, specify it in your Podfile:

target 'TargetName' do
pod 'SCKTEffectSpriteKit'
end

You create the effect by calling the corresponding factory method on the node. Custom methods allow you to adjust the start, end, timing function and duration of the animation.

You can use the supplied timing functions – see SKTTimingFunctions.swift for a complete list.

You can combine multiple effects at the same time, e.g. have more than one scale effect going at once on the same node.

Effects keep state (unlike SKActions), so you should not reuse the same effect instance in multiple actions.

SCKTEffectSceneKit

CocoaPods Compatible

Using SCKTEffects with SceneKit is almost identical:

import SCKTEffectsSceneKit

let node = SCNNode()

let effect = node.moveEffect()
    .animating(SCNVector3(x: 10, y: 5, z: 0))

node.runAction(effect.asAction())

Podfile

To integrate SCKTEffectSceneKit into your Xcode project using CocoaPods, specify it in your Podfile:

target 'TargetName' do
pod 'SCKTEffectSceneKit'
end

Latest podspec

{
    "name": "SCKTEffectsCore",
    "version": "0.1.1",
    "summary": "Provides core logic for SCKTEffects.",
    "description": "This framework serves as the backbone for a custom class which can benanimated using custom animation functions. You wouldn't use this on its own unless you have a custom node hierarchy that you want to animate.nIt is based on SKTEffects by raywenderlich.com.",
    "swift_version": "4.0",
    "homepage": "https://github.com/edwinveger/SCKTEffects",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "edwinveger": "[email protected]"
    },
    "source": {
        "git": "https://github.com/edwinveger/SCKTEffects.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SCKTEffectsCore/Classes/**/*"
}

Pin It on Pinterest

Share This