Skip to content

WasmGPU.createTransform().rotateZ

Summary

WasmGPU.createTransform().rotateZ applies an incremental local rotation around the Z axis. This is often used for roll behavior and 2D-plane orientation updates. Quaternion composition is used internally, followed by normalization. Angles are in radians.

Syntax

WasmGPU.createTransform().rotateZ(angle: number): this
const result = transform.rotateZ(angle);

Parameters

Name Type Required Description
angle number Yes Incremental rotation around Z axis in radians.

Returns

this - Returns the same transform after rotation.

Example

const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);

const spriteAnchor = wgpu.createTransform();
spriteAnchor.rotateZ(Math.PI / 6).rotateZ(-Math.PI / 18);
console.log(spriteAnchor.rotation);

See Also