AxesController
class AxesController
A controller that handles the @egjs/axes events
Properties
axes
An Axes instance
Type: Axes | null
See:
panInput
An PanInput instance
Type: PanInput | null
See:
stateMachine
state
A activated State that shows the current status of the user input or the animation
Type: State
animatingContext
A context of the current animation playing
Type: object
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
start | number | A start position of the animation |
end | number | A end position of the animation |
offset | number | camera offset |
controlParams
A current control parameters of the Axes instance
Type: ControlParams
Returns: ControlParams
enabled
A Boolean indicating whether the user input is enabled
Type: boolean
position
Current position value in Axes instance
Type: number
range
Current range value in Axes instance
Type: Array<number>
bounce
Actual bounce size(px)
Type: Array<number>
Methods
init
Initialize AxesController
Returns: this
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
flicking | Flicking | An 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
release
Releases ongoing user input (mouse/touch)
Returns: this
updateAnimation
Change the destination and duration of the animation currently playing
Returns: this
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
position | number | A position to move | ||
duration | number | ✔️ | Duration of the animation (unit: ms) |
stopAnimation
Stops the animation currently playing
Returns: this
update
Update @egjs/axes's state
Returns: this
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
controlParams | ControlParams |
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
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
position | number | A position to move | ||
duration | number | Duration of the animation (unit: ms) | ||
axesEvent | number | ✔️ | If provided, it'll use its setTo method instead |
Throws: FlickingError
|code|condition|
|---|---|
|NOT_ATTACHED_TO_FLICKING|When init is not called before|
|ANIMATION_INTERRUPTED|When the animation is interrupted by user input|