Coder-ACJHP / SKPulsator

Pulse animation for SKSpriteNode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SKPulsator

Circle pulse animation for SKSpriteNode as extension



How to use?

  • Add SKPulsator.swift file to your project
  • Call the addPulseEffect() function by adding . after your SKSpriteNode name

Example usage :


import SpriteKit
import GameplayKit

class GameScene: SKScene {

private var pulseNode: SKSpriteNode!

override func didMove(to view: SKView) {
    
    self.backgroundColor = .white
    if let node = self.childNode(withName: "anyNode") as? SKSpriteNode {
        self.pulseNode = node
    }
    
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    self.pulseNode.repeatPulseEffectForEver(circleOfRadius: 80)
    
    //self.pulseNode.addPulseEffect(circleOfRadius: 80, backgroundColor: .red)

}

}

And here is UIKit version (lightweight)

License : GNU GENERAL PUBLIC LICENSE V3

About

Pulse animation for SKSpriteNode

License:GNU General Public License v3.0


Languages

Language:Swift 100.0%