scaleBy()

Scales an element by x, y, z relative to its current scaling factors. A scaling factor of 0.0 means inexistent, a factor of 1.0 original size, 2.0 double its original size. scaleBy() adds to or subtracts from this factor on each particular axis. Optionally this method also takes a Tween or Thrust object. Tweens and Thrusts are carried out over the duration of multiple frames. Tweens stop at a predefined end value after a predefined time. Thrusts are carried out until canceled. >> The class reference elaborates on Tweens and Thrusts.

<sprite>.scaleBy(x, y, z)
<tag>.scaleBy(x, y, z)
<tag>.scaleBy(x, y)
  • x, y, z ... values to add to the element's corresponding scaling factors

<sprite>.scaleBy(tweenobj)
<tag>.scaleBy(tweenobj)
  • tweenobj ... an object that describes the tween. Tween objects are usually instanced from classes that take x, y, z values and a time value that specifies the tween's duration.

<sprite>.scaleBy(thrustobj)
<tag>.scaleBy(thrustobj)
  • thrustobj ... an object that describes the thrust. Thrust objects are usually instanced from classes that take x, y, z values. The standard Thrust understands them as change/second.

Relevant examples: tag.py , sprite.py , tag_all.py , sprite_all.py , ALL

In Context

Immediate

s = ASpriteClass(self, 'sprite1')
s.scaleBy(0.5, 0.5, 0.5)
t = ATagClass(self, 'tag1')
t.scaleBy(0.5, 0.5)

Tweens

s = ASpriteClass(self, 'sprite1')
s.scaleBy(Tween(0.5, 0.5, 0.5, 2.0))
t = ATagClass(self, 'tag1')
t.scaleBy(SineTween(0.5, 0.5, 0.0, 2.0))

Thrusts

s = ASpriteClass(self, 'sprite1')
s.scaleBy(Thrust(0.5, 0.5, 0.5))
t = ATagClass(self, 'tag1')
t.scaleBy(FadeinThrust(0.2, 0.2, 0.2))
Initiated by Stephan Hechenberger
Thanks to CADRE's 103