Ccaction class and Ccactioninterval class and Ccactionmoveto class---cocos2d-swift v3.3

Source: Internet
Author: User

Ccaction Class Reference
Inherits from NSObject
Conforms to Nscopying
Declared in CCAction.h
Overview

Ccaction is a abstract base class for all actions. Actions animate nodes by manipulating node properties through time such as position, rotation, scale and opacity.

Ccaction is a basic type of all actions. Activates nodes by manipulating the node property, such as position, rotation, transparency, scale, and so on.

For more information see the Concepts:actions article in the Developer Guide

Subclasses

The following actions inherit directly from Ccaction and can being used "as is":

    • Ccactionfollow (parent node follows the target node ' s movement)
    • Ccactionrepeatforever (runs a ccactioninterval in an endless loop until stopped)
    • Ccactionspeed (modifies the speed of a ccactioninterval action and it is running)

These action subclasses is abstract base classes for instant and ' over time ' actions, see their references for more infor Mation:

    • Ccactionfinitetime
      • Ccactioninstant
      • Ccactioninterval
Taskscreating an Action
    • + action
    • – init
Action Targets
    •   target Property
    •   originalTarget Property
Identifying an Action
    •   tag Property
Action Methods implemented by subclasses
    • – isDone
    • – startWithTarget:
    • – stop
    • – step:
    • – update:
Propertiesoriginaltarget

The original target, since target can be nil.

The original target can be nil.

@property (nonatomic, readonly, unsafe_unretained) id originalTargetDeclared in CCAction.hTag

The action tag. An identifier of the action.

Action tag, which defines an action.

@property (nonatomic, readwrite, assign) NSInteger tagDeclared in CCAction.hTarget

The "target" is typically the node instance that received the [Ccnode runaction:] message. The action would modify the target properties. The target is set with the ' Startwithtarget ' method. When the ' Stop ' method is called, Target would be set to nil.

"Target" is a typical node instance that can receive the [Ccnode runaction:] method. Acition will define the target property. Target can be set by the Startwithtarget method, and when the Stop method is called, the target is reset to nil.

@property (nonatomic, readonly, unsafe_unretained) id targetDiscussion

Warning: The target is ' assigned ' (unsafe unretained), it's not a ' retained ' nor managed by ARC.

Declared in CCAction.hClass methodsaction

Creates and returns an action.

Create and return an action

+ (id)actionReturn Value

The Ccaction Object.

Discussion

Warning: If a ccaction subclass provides designated initializers You'll have the use of those over this one.

Declared in CCAction.hInstance Methodsinit

Initializes and returns an Action object.

Initializes and returns an Action object.

- (id)initReturn Value

An initialized ccaction Object.

Declared in CCAction.hIsDone

Return YES If the action has finished.

returns Yes if the action ends. - (BOOL)isDoneReturn Value

Action Completion Status

Action completion status.

Declared in CCAction.hStartwithtarget:

Assigns a target to the action called before the action is started.

Assigns a target to the action. This is called before the action starts.

- (void)startWithTarget:(id)targetParameters
Target

Target to assign to action (weak reference).

Declared in CCAction.hStep

Steps the action. Called for every frame with step interval.

The action step. Each frame is called, step interval.

- (void)step:(CCTime)dtParameters
Dt

Ellapsed interval since last step.

Discussion

Note:do not the override unless you know is doing.

Declared in CCAction.hStop

Stops the action called after the action has finished. Would assign the internal target reference to nil. Note:you should never call the This method directly. In stead use: [Target stopaction:action]

Stopping a action,action is called after the end. will set the internal target to nil.

You should never call this method directly. Replace with [Target stopaction:action].

- (void)stopDeclared in CCAction.hUpdate

Updates the action with normalized value.

Updates the action with normalized values.

- (void)update:(CCTime)timeParameters
Time

Normalized action progress.

Discussion

For example:a value of 0.5 indicates, the action is 50% complete.

Declared in CCAction.hCcactioninterval Class Reference
Inherits from CCActionFiniteTime:CCAction:NSObject
Conforms to Nscopying
Declared in CCActionInterval.h
Overview

Abstract base class for interval actions. An interval action was an action, that performs it task over a certain period of time.

Abstract basic class about the interval action. An interval action refers to an action that completes the entire process over a period of time.

Most ccactioninterval actions can reversed or has their speed altered via the Ccactionspeed action.

Most ccactioninterval actions can be reversed or changed in rate, through ccactionspeed action.

Moving, rotating, Scaling a Node
    • Moving a node along a straight line or curve:
      • Ccactionmoveby, Ccactionmoveto
      • Ccactionbezierby, Ccactionbezierto
      • Ccactioncardinalsplineto, Ccactioncardinalsplineby
      • Ccactioncatmullromby, Ccactioncatmullromto
    • Rotating a node:
      • Ccactionrotateby, Ccactionrotateto
    • Scaling a node:
      • Ccactionscaleto, Ccactionscaleby
Animating a Node ' s Visual Properties
    • Periodically toggle Visible property on/off:
      • Ccactionblink
    • Fading a node in/out/to:
      • Ccactionfadein, Ccactionfadeout
      • Ccactionfadeto
    • Colorizing a node:
      • Ccactiontintby, Ccactiontintto
    • Skewing a node:
      • Ccactionskewto, Ccactionskewby
    • Animate the sprite frames of a ccsprite with ccanimation:
      • Ccactionanimate
    • Animating a Ccprogressnode:
      • Ccactionprogressfromto, Ccactionprogressto
Repeating and reversing Actions
    • Repeating an action a specific number of times:
      • Ccactionrepeat
    • Reversing an action (if supported by the action):
      • Ccactionreverse
Creating sequences of Actions
    • Creating a linear sequence of actions:
      • Ccactionsequence
      • Wait for a given time in a ccactionsequence:
        • Ccactiondelay
      • Spawning parallel running actions in a ccactionsequence and continue the sequence, all spawned actions are ended:
        • Ccactionspawn
Easing the Duration of an Action
    • Easing duration of a ccactioninterval:
      • Ccactionease
      • Ccactioneasebackin, Ccactioneasebackinout, Ccactioneasebackout
      • Ccactioneasebounce, Ccactioneasebouncein, Ccactioneasebounceinout, Ccactioneasebounceout
      • Ccactioneaseelastic, Ccactioneaseelasticin, Ccactioneaseelasticinout, Ccactioneaseelasticout
      • Ccactioneaserate, Ccactioneasein, Ccactioneaseinout, Ccactioneaseout
      • Ccactioneasesinein, Ccactioneasesineinout, Ccactioneasesineout
Animating Custom Float/double Properties
    • Tweening any node property (of type float or double):
      • Ccactiontween
Tasksother Methods
    •   elapsed Property
Creating a Interval Action
    • + actionWithDuration:
    • – initWithDuration:
Reversing an Action
    • – reverse
Methods implemented by subclasses
    • – isDone
Propertieselapsed

How many seconds had elapsed since the actions started to run.

How long has it been since the action was executed?

@property (nonatomic, readonly) CCTime elapsedDeclared in CCActionInterval.hClass methodsactionwithduration:

Creates and returns an action interval object.

Creates and returns an action interval object.

+ (id)actionWithDuration:(CCTime)dParameters
D

Action interval.

Return Value

The Ccactioninterval object.

Declared in CCActionInterval.hInstance methodsinitwithduration:

Initializes and returns an action interval object.

- (id)initWithDuration:(CCTime)dParameters
D

Action interval.

Return Value

An initialized ccactioninterval Object.

Declared in CCActionInterval.hIsDone

Returns YES If the action has finished.

- (BOOL)isDoneReturn Value

Action Finished status.

Declared in CCActionInterval.hReverse

Returns a reversed action.

- (CCActionInterval *)reverseReturn Value

Created reversed action.

Declared in CCActionInterval.hCcactionmoveto Class Reference
Inherits from CCActionMoveBy:CCActionInterval:CCActionFiniteTime:CCAction:NSObject
Declared in CCActionInterval.h
Overview

This action moves the target to the position specified, these is absolute coordinates. Several Ccmoveto actions can be concurrently called, and the resulting movement would be the sum of individual movements.

Warning: Move actions shouldn ' is used to move nodes with a dynamic ccphysicsbody as both the physics body and the action would alt Er the node ' s position property, overriding each of the other ' s changes. This leads to unpredictable behavior.

Taskscreating a Move Action
    • + actionWithDuration:position:
    • – initWithDuration:position:
Class methodsactionwithduration:position:

Creates the action.

+ (id)actionWithDuration:(CCTime)duration position:(CGPoint)positionParameters
Duration

Action interval.

Position

Absolute position to move to.

Return Value

New moveto action.

Declared in CCActionInterval.hInstance methodsinitwithduration:position:

Initializes the action.

- (id)initWithDuration:(CCTime)duration position:(CGPoint)positionParameters
Duration

Action interval.

Position

Absolute position to move to.

Return Value

New moveto action.

Declared in CCActionInterval.h

Ccaction class and Ccactioninterval class and Ccactionmoveto class---cocos2d-swift v3.3

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.