How to implement Periscope heart animation?

I want to implement something similar, like what periscope does for its streaming application. To be specific, a countless floating heart is emitted when the user touches the screen. Is this possible with SpriteKit or Cocos2D? Can someone throw me a light or at least a good starting point.

thanks

enter image description here

+6
source share
1 answer

This can be achieved with SKEmitterNode

 import SpriteKit let heartsFile = "heart-bubbles.sks"//particle file class HeartBubblesScene : SKScene { var emitter: SKEmitterNode? func beginBubbling() { emitter = SKEmitterNode(fileNamed: heartsFile) let x = floor(size.width / 2.0) let y = heartHeight emitter!.position = CGPointMake(x, y) emitter!.name = "heart-bubbles" emitter!.targetNode = self emitter?.numParticlesToEmit = 1 addChild(emitter!) emitter?.resetSimulation() } } class ViewController: UIViewController { @IBOutlet weak var heartBubblesView: SKView!//Create a custom view inside view controller and set the class to SKView let heartBubblesScene = HeartBubblesScene() override func viewDidLoad() { super.viewDidLoad() heartBubblesView.presentScene(heartBubblesScene) } override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { heartBubblesScene.beginBubbling() } } 

Here is an example of HeartAnimation

+5
source

Source: https://habr.com/ru/post/985568/


All Articles