rotTo()

Rotates an element to x, y, z degrees on the corresponding axis in the parent element's coordinate system. Optionally this method also takes a Tween object. Tweens are carried out over the duration of multiple frames. >> The class reference elaborates on Tweens.

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

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

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

In Context

Immediate

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

Tweens

from slut.element import Tween

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

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

t = ATagClass(self, 'tag1')
t.rotTo(SineTween(0.0, 0.0, 45.0, 2.0))
Initiated by Stephan Hechenberger
Thanks to CADRE's 103