-
-
Save ashishkakkad8/ecc277dec2261af3456c2a1b02386342 to your computer and use it in GitHub Desktop.
SKScene for AKSwiftUIParticles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FirefilesScene.swift | |
// AKSwiftUIParticles | |
// | |
// Created by Ashish Kakkad on 30/04/22. | |
// | |
import SpriteKit | |
class FirefilesScene: SKScene { | |
let snowEmitterNode = SKEmitterNode(fileNamed: "Firefiles.sks") | |
override func didMove(to view: SKView) { | |
guard let snowEmitterNode = snowEmitterNode else { return } | |
snowEmitterNode.particleSize = CGSize(width: 30, height: 30) | |
snowEmitterNode.particleLifetime = 5 | |
snowEmitterNode.particleLifetimeRange = 10 | |
addChild(snowEmitterNode) | |
} | |
override func didChangeSize(_ oldSize: CGSize) { | |
guard let snowEmitterNode = snowEmitterNode else { return } | |
snowEmitterNode.particlePosition = CGPoint(x: size.width/2, y: size.height) | |
snowEmitterNode.particlePositionRange = CGVector(dx: size.width, dy: size.height) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment