Skip to content

jmstajim/Particlized

Repository files navigation

Particlized

Particlized is a Swift library that enables developers to easily turn text, emoji, or images into particles aka SKEmitterNodes.

See more examples on YouTube

Features

  • ParticlizedText: turn text and emoji into particles.
  • ParticlizedImage: turn image into particles.

Installation

Swift Package Manager

  1. In Xcode, go to File > Swift Packages > Add Package Dependency...
  2. Enter the repository URL (https://github.com/jmstajim/Particlized.git).
  3. Follow the steps to specify versioning, branch, or tag.
  4. Click Finish.

CocoaPods

TODO

Usage

  1. Import Particlized module into your view controller:
import Particlized
  1. Create a Particlized instance:
let text = ParticlizedText(
    text: "Oregon 🦫",
    font: UIFont(name: "SnellRoundhand", size: 40)!,
    textColor: .red,
    emitterNode: .init(fileNamed: "TextParticle.sks")!,
    numberOfPixelsPerNode: 2,
    nodeSkipPercentageChance: 0
)

or

let image = ParticlizedImage(
    image: UIImage(named: "oregon")!,
    emitterNode: .init(fileNamed: "ImageParticle.sks")!,
    numberOfPixelsPerNode: 6,
    nodeSkipPercentageChance: 0
)
  1. Add the Particlized object to your SKScene:
scene.addChild(text)
scene.addChild(image)

Customization

The behavior of the Particlized object is overridden from SKEmitterNode, but has not been tested and may not work as expected.

Example

To see Particlized in action, check out the included Demo project. Check ParticlizedDemoApp.swift to choose a scene.

Gestures to try:

  • Tap gesture x1, x2, x3 times
  • Long press gesture
  • Drag gesture

Limitations

By default, SKEmitterNodes are created for each pixel. Be mindful of device resources.

License

Particlized is available under the MIT license. See the LICENSE file for more info.

Support

For any questions, issues, or feature requests, please open an issue on GitHub

or reach out to gusachenkoalexius@gmail.com or LinkedIn.