rotBy()

Rotates an element by x, y, z around the corresponding axis relative to the element's current rotation. 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.

<camera>.rotBy(x, y, z)
<sprite>.rotBy(x, y, z)
<tag>.rotBy(x, y, z)
<tag>.rotBy(z)
  • x, y, z ... degrees around the various axis. (corrected Euler angels)

<camera>.rotBy(tweenobj)
<sprite>.rotBy(tweenobj)
<tag>.rotBy(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.

<camera>.rotBy(thrustobj)
<sprite>.rotBy(thrustobj)
<tag>.rotBy(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

def onSetup(self):
    self.camera.rotBy(10.0, 0.0, 0.0)
s = ASpriteClass(self, 'sprite1')
s.rotBy(0.0, 90.0, 0.0)
t = ATagClass(self, 'tag1')
t.rotBy(180)

Tweens

from slut.element import Tween

def onSetup(self):
    self.camera.rotBy(Tween(0.0, 0.0, -90.0, 2.0))
from slut.element import Tween

s = ASpriteClass(self, 'sprite1')
s.rotBy(Tween(90.5, 0.0, 0.0, 2.0))
from slut.element import SineTween

t = ATagClass(self, 'tag1')
t.rotBy(SineTween(0.0, 0.0, 45.0, 2.0))

Thrusts

from slut.element import Thrust

def onSetup(self):
    self.camera.rotBy(Thrust(0.0, 0.0, 20.0))
from slut.element import Thrust

s = ASpriteClass(self, 'sprite1')
s.rotBy(Thrust(30.0, 0.0, 0.0))
from slut.element import FadeinThrust

t = ATagClass(self, 'tag1')
t.rotBy(FadeinThrust(30.5, 0.0, 0.0))
Initiated by Stephan Hechenberger
Thanks to CADRE's 103