Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ActionInterval

!#en

An interval action is an action that takes place within a certain period of time.
It has an start time, and a finish time. The finish time is the parameter
duration plus the start time.

These CCActionInterval actions have some interesting properties, like:
- They can run normally (default)
- They can run reversed with the reverse method
- They can run with the time altered with the Accelerate, AccelDeccel and Speed actions.

For example, you can simulate a Ping Pong effect running the action normally and
then running it again in Reverse mode.

!#zh 时间间隔动作,这种动作在已定时间内完成,继承 FiniteTimeAction。
param

duration in seconds

Hierarchy

Index

Constructors

constructor

Properties

Protected MAX_VALUE

MAX_VALUE: number = 2

_duration

_duration: number = 0

Protected _easeList

_easeList: Function[] = []

Protected _elapsed

_elapsed: number = 0

Protected _firstTick

_firstTick: boolean = false

Protected _repeatForever

_repeatForever: boolean = false

_repeatMethod

_repeatMethod: boolean = false

Protected _speed

_speed: number = 1

Protected _speedMethod

_speedMethod: boolean = false

_timesForRepeat

_timesForRepeat: number = 1

Protected originalTarget

originalTarget: Node | null = null

Protected tag

tag: number = Action.TAG_INVALID

Protected target

target: Node | null = null

Static TAG_INVALID

TAG_INVALID: number = -1

!#en Default Action tag. !#zh 默认动作标签。

constant
static
default

-1

Methods

cloneDecoration

computeEaseTime

  • computeEaseTime(dt: any): any

reverseEaseList

clone

easing

getAmplitudeRate

  • getAmplitudeRate(): number

getDuration

  • getDuration(): number

getElapsed

  • getElapsed(): number

getOriginalTarget

  • getOriginalTarget(): Node | null

getSpeed

  • getSpeed(): number

getTag

  • getTag(): number

getTarget

  • getTarget(): Node | null

initWithDuration

  • initWithDuration(d: number): boolean

isDone

  • isDone(): boolean

release

  • release(): void

repeat

  • !#en Repeats an action a number of times. To repeat an action forever use the CCRepeatForever action. !#zh 重复动作可以按一定次数重复一个动作,使用 RepeatForever 动作来永远重复一个动作。

    method

    repeat

    Parameters

    • times: number

    Returns ActionInterval

repeatForever

  • !#en Repeats an action for ever.
    To repeat the an action for a limited number of times use the Repeat action.
    !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 Repeat 动作。

    method

    repeatForever

    Returns ActionInterval

retain

  • retain(): void

reverse

  • reverse(): this

setAmplitudeRate

  • setAmplitudeRate(amp: any): void

setDuration

  • setDuration(duration: number): void

setOriginalTarget

  • setOriginalTarget(originalTarget: any): void

setSpeed

setTag

  • setTag(tag: number): void

setTarget

  • setTarget(target: Node): void

speed

  • speed(speed: number): Action
  • !#en Changes the speed of an action, making it take longer (speed>1) or less (speed<1) time.
    Useful to simulate 'slow motion' or 'fast forward' effect. !#zh 改变一个动作的速度,使它的执行使用更长的时间(speed > 1)
    或更少(speed < 1)可以有效得模拟“慢动作”或“快进”的效果。

    Parameters

    • speed: number

    Returns Action

startWithTarget

  • startWithTarget(target: any): void

step

  • step(dt: number): void

stop

  • stop(): void

update

  • update(dt: number): void

Generated using TypeDoc