SpriteKit(2) - 场景过渡动画

 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))
    }
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容