Skip to main content
Version: 4.2.5

AxesController

⚠️ This class is for internal use only.
class AxesController

A controller that handles the @egjs/axes events

Properties

axes

readonly

An Axes instance

Type: Axes

See:

stateMachine

⚠️ This member is for internal use only.

state

A activated State that shows the current status of the user input or the animation

Type: State

animatingContext

readonly

A context of the current animation playing

Type: object

PROPERTYTYPEDESCRIPTION
startnumberA start position of the animation
endnumberA end position of the animation
offsetnumbercamera offset

controlParams

A current control parameters of the Axes instance

Type: ControlParams

Returns: ControlParams

enabled

readonly

A Boolean indicating whether the user input is enabled

Type: boolean

position

readonly

Current position value in Axes instance

Type: number

range

readonly

Current range value in Axes instance

Type: Array<number>

bounce

readonly

Actual bounce size(px)

Type: Array<number>

Methods

init

Initialize AxesController

Returns: this

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
flickingFlickingAn instance of Flicking

destroy

Destroy AxesController and return to initial state

Returns: void

enable

Enable input from the user (mouse/touch)

Returns: this

disable

Disable input from the user (mouse/touch)

Returns: this

update

Update @egjs/axes's state

Returns: this

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
controlParamsControlParams

Throws: FlickingError

NOT_ATTACHED_TO_FLICKING When init is not called before

addPreventClickHandler

Attach a handler to the camera element to prevent click events during animation

Returns: this

removePreventClickHandler

Detach a handler to the camera element to prevent click events during animation

Returns: this

animateTo

Run Axes's setTo using the given position

Returns: Promise<void>

  • A Promise which will be resolved after reaching the target position
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
positionnumberA position to move
durationnumberDuration of the animation (unit: ms)
axesEventnumber✔️If provided, it'll use its setTo method instead

Throws: FlickingError

codecondition
NOT_ATTACHED_TO_FLICKINGWhen init is not called before
ANIMATION_INTERRUPTEDWhen the animation is interrupted by user input