Class: KeyControlMethod

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

Sets 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()

Destructor.