Rotate
Allows you to rotate an element.
new rotate(rotateOptions)Basic implementation
Section titled “Basic implementation”const circle = new rotate({ element: '.circle1' });rotateOptions
Section titled “rotateOptions”interface RotateOptions { element: string; snapAngle?: number; onRotation?: (angle: number) => void;}element
Section titled “element”Type:
type element = stringThe element selector.
snapAngle
Section titled “snapAngle”Type:
type snapAngle = numberdefault: 1
The angle that the rotation snaps to.
onRotation
Section titled “onRotation”Type:
type onRotation = (angle: number) => void;Executes when the element rotates.
Properties
Section titled “Properties”actionName readonly
Section titled “actionName ”Type:
type actionName = stringThe name of the action that can be used to programmatically rotate the element.
touchEnabled
Section titled “touchEnabled”Type:
type touchEnabled = booleanEnables or disables touch events. Default is false.
Methods
Section titled “Methods”deinit()
Section titled “deinit()”Removes the event listeners and disables the rotate functionality.
Actions
Section titled “Actions”You are able to rotate elements using actions. Since every rotate action is unique you can do the following:
const element = new rotate({ element: '.circle1' });
actions.execute(element.actionName, 90);