Class: KeyControlMethod

KeyControlMethod(keyCode, parameter, velocity, friction, elementopt)

Set the velocity and friction of a single parameter by pressing and unpressing a key.

Constructor

new KeyControlMethod(keyCode, parameter, velocity, friction, elementopt)

Parameters:
Name Type Attributes Default Description
keyCode Number

Key which activates the method when pressed

parameter String

The parameter to be controlled (e.g. x, y or zoom)

velocity Number

Velocity at which the parameter changes. Use a negative number for opposite direction

friction Number

Friction at which the parameter stops

element Element <optional>
document

DOM element where the key events are listened to

Implements:

Methods

destroy()

Destroy the instance