Particlized is a Swift library that enables developers to easily turn text, emoji, or images into particles aka SKEmitterNodes.
- ParticlizedText: turn text and emoji into particles.
- ParticlizedImage: turn image into particles.
- In Xcode, go to
File
>Swift Packages
>Add Package Dependency...
- Enter the repository URL (https://github.com/jmstajim/Particlized.git).
- Follow the steps to specify versioning, branch, or tag.
- Click
Finish
.
TODO
- Import Particlized module into your view controller:
import Particlized
- 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
)
- Add the Particlized object to your SKScene:
scene.addChild(text)
scene.addChild(image)
The behavior of the Particlized object is overridden from SKEmitterNode, but has not been tested and may not work as expected.
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
By default, SKEmitterNodes are created for each pixel. Be mindful of device resources.
Particlized is available under the MIT license. See the LICENSE file for more info.
For any questions, issues, or feature requests, please open an issue on GitHub
or reach out to gusachenkoalexius@gmail.com or LinkedIn.