scale(x: number, y: number): ScaleComp

Set the scale of a Game Object.

paramx- The x scale to set.

paramy- The y scale to set.

// scale uniformly with one value
add([
    sprite("bean"),
	   scale(3),
]);

// scale with x & y values. In this case, scales more horizontally.
add([
    sprite("bean"),
	   scale(3, 1),
]);

 // scale with vec2(x,y).
bean.scale = vec2(2,4);

returnsThe scale comp.

sincev2000.0

scale(xy: number): ScaleComp

scale(s: Vec2): ScaleComp

kaplay logo

Misc

Layer