All Projects → maxgribov → Spine

maxgribov / Spine

Licence: MIT License
Unofficial Spine runtime Swift library, allows you to play animations created in the Spine app (http://esotericsoftware.com).

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Spine

Activityrings
An attempt to recreate the ring controls in Apple’s Activity app
Stars: ✭ 88 (-29.6%)
Mutual labels:  tvos, watchos, spritekit
Johnny
Melodic Caching for Swift
Stars: ✭ 36 (-71.2%)
Mutual labels:  tvos, watchos
Jsonify
♨️A delightful JSON parsing framework.
Stars: ✭ 42 (-66.4%)
Mutual labels:  tvos, watchos
PotentCodables
🧪 PotentCodables - A potent set of implementations and extensions to the Swift Codable system
Stars: ✭ 32 (-74.4%)
Mutual labels:  tvos, watchos
CombineCoreBluetooth
A wrapper API for CoreBluetooth using Combine Publishers
Stars: ✭ 50 (-60%)
Mutual labels:  tvos, watchos
SeedTruck
Torrent management app for iOS, macOS, tvOS and watchOS made in SwiftUI 2. Same codebase for all platforms!
Stars: ✭ 25 (-80%)
Mutual labels:  tvos, watchos
Hostess.swift
A Swift implementation of NSHost that works on iOS, OS X and tvOS. Hostess.swift is safe to use in a framework because it does not require a bridging header. Hostess is Swift 4.0 (or newer) only and replaces the Swift 2.x only Host.swift.
Stars: ✭ 27 (-78.4%)
Mutual labels:  tvos, watchos
IrregularGradient
Create animated irregular gradients in SwiftUI.
Stars: ✭ 127 (+1.6%)
Mutual labels:  tvos, watchos
Mechanica
A cross-platform library of Swift utils to ease your iOS | macOS | watchOS | tvOS and Linux development.
Stars: ✭ 27 (-78.4%)
Mutual labels:  tvos, watchos
Columbus
A feature-rich country picker for iOS, tvOS and watchOS.
Stars: ✭ 23 (-81.6%)
Mutual labels:  tvos, watchos
swift-standard-clients
Client declarations and live implementations for standard iOS managers
Stars: ✭ 28 (-77.6%)
Mutual labels:  tvos, watchos
stinsen
Coordinators in SwiftUI. Simple, powerful and elegant.
Stars: ✭ 563 (+350.4%)
Mutual labels:  tvos, watchos
lisk-swift
Swift 4 library for Lisk - Including Local Signing for maximum security
Stars: ✭ 13 (-89.6%)
Mutual labels:  tvos, watchos
SwiftRadix
Easily convert integers to binary/hex/octal strings and back again with clean functional syntax.
Stars: ✭ 34 (-72.8%)
Mutual labels:  tvos, watchos
Dots
Lightweight Concurrent Networking Framework
Stars: ✭ 35 (-72%)
Mutual labels:  tvos, watchos
TinyRage
Flappy Bird for WatchOS 6+ written in swift 5 using spriteKit
Stars: ✭ 23 (-81.6%)
Mutual labels:  watchos, spritekit
SnakeClassic
A snake engine written in SpriteKit for all Apple devices.
Stars: ✭ 56 (-55.2%)
Mutual labels:  watchos, spritekit
QuoteKit
A framework to use the free APIs provided by https://quotable.io
Stars: ✭ 17 (-86.4%)
Mutual labels:  tvos, watchos
tracelog
TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS.
Stars: ✭ 52 (-58.4%)
Mutual labels:  tvos, watchos
Apple-Platform-Security-Guides
Every Apple Platform Security Guide
Stars: ✭ 106 (-15.2%)
Mutual labels:  tvos, watchos

Build Status Pod Version

Spine

This Swift library allows you to upload characters and their animations from the Spine app (v3.8.x +) to SpriteKit for platforms:

iOS macOS tvOS watchOS

Implemented almost all the functionality of the essential version of Spine app: Animation of bones, skins, animation of slots, creation of physical bodies on the basis of bounding boxes and some other. See Implemented Features for more information.

Example of working with the library: Sample project
Learn more about working with the library: Spine Wiki

Hero

Installing

CocoaPods

Add the pod to your podfile

pod 'Spine'

run

pod install

Basic Usage

Assets

Files

  1. In assets catalog create folder. (Goblins folder in example below)
  2. Create sprite atlases. (default, goblin and goblingirl sprite atlases in example below)
  3. Put images into sprite atlaces.

Note that the images that are in the root folder of the Spine app project must be in the sprite atlas named default in the Xcode project.

Final result should looks something like this:

Assets

Namespace

Set Provides Namespace option enabled for the root folder and for all sprite atlases in the Xcode's attribute inspector:

Namespace

If you forget to set the namespace, later when you initialize your character images can be just not found.

JSON

Put the JSON exported from the Spine application somewhere in your project:

json

For more information about assets see Assets Wiki

Code

Somewhere at the beginning of your code, import the Spine library:

import Spine

The easiest way to load a character from a JSON file and apply skin to it is to use the appropriate Skeleton class constructor:

if let character = Skeleton(fromJSON: "goblins-ess", atlas: "Goblins", skin: "goblin") {

   //Do something with your character here
}

Skeleton is a subclass of SKNode, so you can do with it whatever you can do with SKNode itself

This way you can apply the animation created in Spine to the character:

if let walkAnimation = character.animation(named: "walk") {

    character.run(walkAnimation)
}

The animation(named:) method returns an object of the SKAction class so that you can use this animation as any other object of the SKAction class

This is an example of the simplest scene in which we load our Goblin character, add it to the scene and start walk animation in an endless loop:

import SpriteKit
import Spine

class GameScene: SKScene {
    
    override func didMove(to view: SKView) {
        
        if let character = Skeleton(fromJSON: "goblins-ess", atlas: "Goblins", skin: "goblin"){
            
            character.name = "goblin"
            character.position = CGPoint(x: self.size.width / 2, y: (self.size.height / 2))
            
            self.addChild(character)

            if let walkAnimation = character.animation(named: "walk") {
                
                character.run(SKAction.repeatForever(walkAnimation))
            }
        }
    }
}

Implemented Features

Name Model Feature Animation
Bones
- Rotation + + +
- Translation + + +
- Scale + + +
- Shear + - -
Bones extras:
- Reflect + -
- Rotation Inheritance + -
- Scale Inheritance + -
- Reflect Inheritance + -
Slots
- Attachment + + +
- Tint Color + + +/-
- Dark Tint Color + -
Skins + +
Attachments
- Region + +
- Mesh + - -
- Linked Mesh + - -
- Bounding Box + + -
- Path + - -
- Point + +
- Clipping + - -
Constraints
- IK Constraint + - -
- Transform Constraint + - -
- Path Constraint + - -
Events + + +
Draw Order + + +

System Requirements

Swift 5.0

  • iOS 8.0+
  • macOS 10.10+
  • tvOS 9.0+
  • watchOS 3.0+

License

This project is licensed under the MIT License - see the LICENSE file for details

Useful links

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