[SKAction]

 1、Every action is an opaque object that describes a change you want to make to the scene. All actions are implemented by the SKAction class; there are no visible subclasses.

 2、Actions can either be instantaneous or non-instantaneous:

  • An instantaneous action starts and completes in a single frame of animation. For example, an action to remove a node from its parent is an instantaneous action because a node can’t be partially removed. Instead, when the action executes, the node is removed immediately.

  • A non-instantaneous action has a duration over which it animates its effects. When executed, the action is processed in each frame of animation until the action completes.

 3、Tip: Because actions are effectively immutable objects, you can run the same action safely on multiple nodes in the tree at the same time. For this reason, if you have an action that is used repeatedly in your game, create a single instance of the action and then reuse it whenever you need a node to execute it.

 4、If a node is running any actions, its hasActions property returns YES.

 5、Because action processing is tied to the scene, actions are processed only when the node is part of a presented scene’s node tree. You can take advantage of this feature by creating a node and assigning actions to it, but waiting until later to add the node to the scene. Later, when the node is added to the scene, it begins executing its actions immediately.

 6、Canceling Running Actions

  To cancel actions that a node is running, call its removeAllActions method. All actions are removed from the node immediately. If a removed action had a duration, any changes it already made to the node remain intact, but further changes are not executed.

 7、Receiving a Callback when an Action Completes

  The runAction:completion: method is identical to the runAction: method, but after the action completes, your block is called. This callback is only called if the action runs to completion. If the action is removed before it completes, the completion handler is never called.

 8、Using Named Actions for Precise Control over Actions

  If you need to see whether a particular action is executing or remove a specific action, you must use named actions.

  The following key-based methods are available:

  • runAction:withKey: method to run the action. If an action with the same key is already executing, it is removed before the new action is added.

  • actionForKey: method to determine if an action with that key is already running.

  • removeActionForKey: method to remove the action.

 9、Repeating Actions Execute Another Action Multiple Times

  

  

 10、Configuring Action Timing

  • Normally, an animated action runs linearly. You can use an action’s timingMode property to choose a nonlinear timing mode for an animation. For example, you can have the action start quickly and then slow down over the remainder of the run.

  • An action’s speed property changes the rate at which an animation plays. You can speed up or slow down an animation from its default timing.

    A speed value of 1.0 is the normal rate. If you set an action’s speed property to 2.0, when the action is executed by a node, it plays twice as fast. To pause the action, set the value to 0.

    If you adjust the speed of an action that contains other actions (such as a group, sequence, or repeating action), the rate is applied to the actions contained within. The enclosed actions are also affected by their own speed property.

  • A node’s speed property has the same effect as the action’s speed property, but the rate is applied to all actions processed by the node or by any of the node’s descendants in the scene tree.

  Sprite Kit determines the rate at which an animation applies by finding all of the rates that apply to the action and multiplying them.

 11、Tips for Working with Actions   

  following tips might be useful:

  • A node’s userData property

  • The parent node’s userData property, if dozens of nodes share the same actions and the same parent

  • The scene’s userData property for actions shared by multiple nodes throughout the scene

  

SKAction的更多相关文章

  1. SKAction类

    继承自 NSObject 符合 NSCodingNSCopyingNSObject(NSObject) 框架  /System/Library/Frameworks/SpriteKit.framewo ...

  2. IOS 2D游戏开发框架 SpriteKit-->续(创建用户角色精灵--原创)

    一.主要实现   今天spritekit实现创建玩家角色精灵(SKSpriteNode *), 增加角色精灵的手势操作,这里增加的手势计算方法与objective-c中是不一样的,因为objectiv ...

  3. IOS 2D游戏开发框架 SpriteKit-->续(创建敌对精灵)

    这次包括之后讲的spritekit 我都会围绕一个案例来说,这个案例就是一个简单的2d飞机大战游戏,今天这里我讲创建敌对精灵,就是敌对飞机,敌对飞机不停的被刷新到屏幕上.....当然这里涉及到的类其实 ...

  4. IOS 2D游戏开发框架 SpriteKit-->续(完善角色功能)

    一.说明       今天给角色精灵增加了子弹发射功能,增加了子弹与敌对精灵的碰撞检测,当角色精灵子弹与敌对精灵碰撞后,它们都会从屏幕上消失. 二.场景层SKScene的修改 1. 在初始化场景层的方 ...

  5. IOS 2D游戏开发框架 SpriteKit

    最近发现Xcode自带的2D游戏开发框架SpriteKit可以直接引入到APP中进行混合开发,这就是说可以开发出既带业务应用又带游戏的苹果APP,咋怎么觉得这是一个自己的小发现....呵呵....., ...

  6. .net程序员转行做手游开发经历(三)

    这次就主要讲讲我们开发的过程. 策划是我们团队的一个人成员专门负责,我们几个算是出谋划策.我这边的理解是,策划首先需要对所做的事情一定要有一定的把握,意思是尽可能的想到这件事情的影响范围,类似项目管理 ...

  7. iOS 10.0 更新点(开发者视角)

    html, body {overflow-x: initial !important;}html { font-size: 14px; } body { margin: 0px; padding: 0 ...

  8. Swift 3 新特性

    原文:What's New in Swift 3? ,作者:Ben Morrow,译者:kmyhy Swift 3将于今年下半年推出,为Swift开发者们带来了很多核心代码的改变.如果你没有关注过 S ...

  9. iOS 7新功能例子

    参考https://github.com/shu223/iOS7-Sampler Code examples for the new functions of iOS 7. Contents Dyna ...

随机推荐

  1. @Inject.@Resource.@Autowired 的区别

    @Inject:Struts2的注解, @Resource : J2EE提供,用于注入,( j2ee提供的 ) 默认按名称装配,@Resource(name="beanName") ...

  2. 基于Flume的美团日志收集系统(二)改进和优化

    在<基于Flume的美团日志收集系统(一)架构和设计>中,我们详述了基于Flume的美团日志收集系统的架构设计,以及为什么做这样的设计.在本节中,我们将会讲述在实际部署和使用过程中遇到的问 ...

  3. 工作流Activiti5流程变量 任务变量 setVariables 跟 setVariablesLocal区别

    工作流Activiti5流程变量 任务变量 setVariables 和 setVariablesLocal区别 因为网上的资料比较少.结合源码把相关API写下来. 设置流程级别变量: runtime ...

  4. Servlet容器的启动(Tomcat为例)

    一.容器简介 在tomcat容器等级中,context容器直接管理servlet在容器中的包装类Wrapper,所以Context容器如何运行将直接影响servlet的工作方式. tomcat容器模型 ...

  5. 使用Jekyll搭建博客

    最近闲来无事,捣鼓了一下Git以及Github,尝试了一下基于Jekyll搭建个人博客的方法,现在把整个过程进行一个总结(部分内容转自互联网): <img src="http://up ...

  6. 【ASP.NET Web API教程】1.1 第一个ASP.NET Web API

    Your First ASP.NET Web API (C#)第一个ASP.NET Web API(C#) By Mike Wasson|January 21, 2012作者:Mike Wasson ...

  7. ASIFormDataRequest 登录

    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL: [NSURL URLWithString: @"http: ...

  8. ArcGIS Engine栅格数据使用总结

    jojojojo2002 原文 ArcGIS Engine栅格数据使用总结 简介:ArcGIS Engine栅格数据使用总结,一个栅格数据集由一个或者多个波段(RasterBand)的数据组成,一个波 ...

  9. Struts2配置细节

    struts.xml中 action中配置 如果是返回到网页则 /AA/XX.jsp 如果是返回到action则看namespace然后传参数,如果是同一个namespace则直接写上返回的actio ...

  10. [转载]C++异常机制的实现方式和开销分析

    原文章网址:http://baiy.cn/doc/cpp/inside_exception.htm C++异常机制的实现方式和开销分析 白杨 http://baiy.cn 在我几年前开始写<C+ ...