On this page, you'll learn about the 'scale' method to rescale an object and the 'rotate' method to move around it.
scale
manimlib.mobject.mobject.Mobject.scale(self, scale_factor, **kwargs)
Resize the object by the given scale_factor times. If it is greater than 1, it enlarges, and if it is smaller, it reduces.
When zoomed in, the reference point is the center of the object by default.
The about_edge parameter can be used as a reference point to be enlarged, and the value must be a vector value representing a point.
If about_edge=RIGHT, the zoom is made based on the right point of the object.
If about_point=mob.get_top(), zooming is performed based on the top point of the object.
Parameters: scale_factor
The multiple value to zoom.
If it is greater than 1, it expands, and if it is smaller, it reduces.
Parameters: **kwargs
- about_edge:
The vector on which the zoom will proceed. LEFT/RIGHT/UP/DOWN
When a value indicating the direction is given by about_edge,
the point that becomes the center of this direction becomes
about_point internally and the scale is changed.
- about_point: Point value to be the basis for zooming
Returns: The resized object itself
rotate
manimlib.mobject.mobject.Mobject.rotate(self, angle, axis=OUT, **kwargs)
Rotates the object by angle. The unit of angle is radians.
The value of angle is 0 on the x-axis, and the value increases as it goes counterclockwise, and becomes 90 degrees when it meets the y-axis.
Parameters: angle
Parameters: axis
Angle to rotate. Increase counterclockwise on the x-axis (rotate clockwise if axis=IN)
Parameters: **kwargs
- about_edge: The direction of the object that is the base when rotating.
LEFT/RIGHT/UP/DOWN
- about_point: The point of the object that is the base when rotating
Returns: The rotated object itself
If you rotate the text 45 degrees counterclockwise,
text.rotate(45 * DEGREES, OUT)
The angle given as a parameter of rotate method is in radians, so if it is 45 degrees, it should be expressed as TAU/8 or 45 * DEGREES.
The values defined for constants.py file with respect to angles are:
- PI = np.pi
- TAU = 2 * PI
- DEGREES = TAU / 360
Next: [05-1-F]Status methods: copy, save_state, restore
Go To: [99] Table of Contents
'Programming > Manim Lectures' 카테고리의 다른 글
[05-2] Text, Equation (0) | 2020.06.06 |
---|---|
[05-1-F]Status methods: copy, save_state, restore (0) | 2020.06.05 |
[05-1-D]Coloring methods: set_color, set_color_by_gradient (0) | 2020.06.05 |
[05-1-C]Aligning methods: align_to, arrange, arrange_in_grid (0) | 2020.06.05 |
[05-1-B]Dimensional methods: get_width/height/top, set_width/height (0) | 2020.06.05 |