Upgrade to Pro — share decks privately, control downloads, hide ads and more …

まだiOSでリッチな演出に疲弊してるの?

Ryusuke Fuda
February 14, 2015

 まだiOSでリッチな演出に疲弊してるの?

iOSオールスターズ勉強会発表資料です。

Ryusuke Fuda

February 14, 2015
Tweet

More Decks by Ryusuke Fuda

Other Decks in Programming

Transcript

  1. SKSceneͱSKSceneͷαϒΫϥεΛ༻ҙ͠ɺ ύʔςΟΫϧͳͲԋग़Λ௥Ճ͢Δ func fireHeart(point:CGPoint) { let path = NSBundle.mainBundle().
 pathForResource("heartSpark",

    ofType: "sks") let sceneData = NSData(contentsOfFile: path!, ɹɹɹɹɹɹɹɹɹɹɹɹɹɹoptions: .DataReadingMappedIfSafe, error: nil)! let particle = NSKeyedUnarchiver.unarchiveObjectWithFile(path!) as SKEmitterNode particle.position = point self.addChild(particle) } Step.2
  2. ޷͖ͳλΠϛϯάͰSKSceneΫϥεͷԋग़ΛݺͿ @IBAction func tapFavoriteButton(sender: AnyObject) {
 let scene = UIScene.unarchiveFromFile("UIScene")

    as UIScene! let location = CGPointMake(sender.position.x - 50, sender.position.y) scene.fireHeart(location) } Step.4
  3. SKActionͰύʔςΟΫϧʹΞχϝʔγϣϯΛ͚ͭΔ let scale = SKAction.scaleTo(1.0, duration: 1.0) let fadeout =

    SKAction.fadeOutWithDuration(0.5) let remove = SKAction.removeFromParent() let sequence = SKAction.sequence([scale, fadeout,remove]) particle.runAction(sequence) Animation
  4. UIViewͷ( 0,0 ) ͱSKViewͷ ( 0,0 ) ͸ҧ͏ override func

    touchesBegan(touches: NSSet, withEvent event: UIEvent) { ! for touch: AnyObject in touches { let location = touch.locationInView(self.view) scene.tapCircle(CGPointMake(location.x, self.view.bounds.height - location.y)) } } ! ( 0,0 ) UIView ( 0,0 ) SKView