Skip to content

Rotate

Allows you to rotate an element.

new rotate(rotateOptions)
const circle = new rotate({ element: '.circle1' });
interface RotateOptions {
element: string;
snapAngle?: number;
onRotation?: (angle: number) => void;
}

Type:

type element = string

The element selector.

Type:

type snapAngle = number

default: 1

The angle that the rotation snaps to.

Type:

type onRotation = (angle: number) => void;

Executes when the element rotates.

Type:

type actionName = string

The name of the action that can be used to programmatically rotate the element.

Type:

type touchEnabled = boolean

Enables or disables touch events. Default is false.

Removes the event listeners and disables the rotate functionality.

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);