ARKIT

SpriteKit(2) - 场景过渡动画

2017-07-27  本文已影响103人  li_礼光
 func animationAll() {
        let nextScene = NewGameScene(size: self.size)
        //交叉淡入淡出
        self.view?.presentScene(nextScene, transition: .crossFade(withDuration: 0.5))
        //从左右两边水平关闭
        self.view?.presentScene(nextScene, transition: .doorsCloseVertical(withDuration: 0.5))
        //从上下两边垂直关闭
        self.view?.presentScene(nextScene, transition: .doorsCloseHorizontal(withDuration: 0.5))
        //从左右两边水平打开
        self.view?.presentScene(nextScene, transition: .doorsOpenVertical(withDuration: 0.5))
        //从上下两边垂直打开
        self.view?.presentScene(nextScene, transition: .doorsOpenHorizontal(withDuration: 0.5))
        //旧场景从中间两边打开,新场景从后方屏幕靠近
        self.view?.presentScene(nextScene, transition: .doorway(withDuration: 0.5))
        //先变成指定颜色,在变成目标场景
        self.view?.presentScene(nextScene, transition: .fade(with: SKColor.blue, duration: 0.5))
        //先变成黑色,在变成目标场景
        self.view?.presentScene(nextScene, transition: .fade(withDuration: 0.5))
        //水平翻转
        self.view?.presentScene(nextScene, transition: .flipVertical(withDuration: 0.5))
        //垂直翻转
        self.view?.presentScene(nextScene, transition: .flipHorizontal(withDuration: 0.5))
        //一个新场景从指定方向进入
        self.view?.presentScene(nextScene, transition: .moveIn(with: .down, duration: 0.5))
        //一个新场景从指定方向推入
        self.view?.presentScene(nextScene, transition: .push(with: .down, duration: 0.5))
        //一个旧场景向指定方向移除,新场景在旧场景下面
        self.view?.presentScene(nextScene, transition: .reveal(with: .down, duration: 0.5))
    }
上一篇下一篇

猜你喜欢

热点阅读