Function

onScroll

(action: (delta: Vec2) => void): KEventController

Register an event that runs when mouse wheel scrolled.

param action- The function to run when the event is triggered.

// Zoom camera on scroll
onScroll((delta) => {
    const zoom = delta.y / 500;
    camScale(camScale().add(zoom));
});

returns The event controller.

since v3000.0

group Input

kaplay logo

Layer

Miscalenous