Skip to content

1681-engine / pixel / SwayProp

Class: SwayProp ​

Defined in: src/pixel/SwayProp.ts:71

One sprite swaying in the wind, in whole world pixels. The placed image becomes the rig's first (largest) still piece — so whatever culls, fades or sorts it keeps working — and the other pieces and the strips are sprites beside it in the same parent, at its depth, following its visibility and alpha. A strip's sprite is moved only when its whole-pixel offset changes.

Constructors ​

Constructor ​

ts
new SwayProp(
   img, 
   def, 
   options?
): SwayProp;

Defined in: src/pixel/SwayProp.ts:81

Parameters ​

ParameterType
imgImage
defSwayDef
optionsSwayPropOptions

Returns ​

SwayProp

Properties ​

active ​

ts
readonly active: boolean;

Defined in: src/pixel/SwayProp.ts:79

False when the frame is too small or the rig has nothing to move: update then does nothing.

Methods ​

destroy() ​

ts
destroy(): void;

Defined in: src/pixel/SwayProp.ts:142

Returns ​

void


update() ​

ts
update(
   tSec, 
   air, 
   enabled?
): void;

Defined in: src/pixel/SwayProp.ts:120

tSec seconds of any steady clock; enabled false stands everything still (an ambient-effects setting).

Parameters ​

ParameterTypeDefault value
tSecnumberundefined
airSwayWindundefined
enabledbooleantrue

Returns ​

void

Released under the MIT License.