TextRotation

Rotation of a 2D text

Value Summary

OptionalReal-valued expression (interpreted in radians)

Graphics Primitives

ObjectsTextRotation Default Values
plot::Integral, plot::Text2d0

Description

TextRotation sets the rotation angle of a 2D text object relative to the horizontal axis.

TextRotation rotates a text object of type plot::Text2d. around its anchor point (the attribute Position of a plot::Text2d object). Note that a plot::Text2d allows different alignments (HorizontalAlignment, VerticalAlignment) relative to this point.

The rotation angle in TextRotation = angle has to be entered in radians. If positive, the rotation is counterclockwise.

The rotation of the text refers to 'rotation on the screen'. It is invariant w.r.t. rescaling of the canvas, aspect ratio etc.

While TextRotation is used for rotating 2D texts, TextOrientation is used for rotating a 3D text of type plot::Text3d.

TextRotation can be animated.

Examples

Example 1

We draw a rectangle and a rotating text inside:

r := plot::Rectangle(0..4, 0..4):
p := plot::Point2d([2, 2], PointSize = 3*unit::mm):
text := plot::Text2d("Hello world!", [2, 2], 
                     HorizontalAlignment = Center,
                     TextRotation = a, a = 0..2*PI,
                     TextFont = [24]):
plot(r, p, text):

We change the alignment of the text w.r.t. its anchor point [2, 2]:

text:: HorizontalAlignment := Left:
text:: VerticalAlignment := Top:
plot(r, p, text):

text:: HorizontalAlignment := Center:
text:: VerticalAlignment := Center:
plot(r, p, text):

delete r, p, text:

See Also

MuPAD Functions

Was this topic helpful?