본문 바로가기

Programming

(165)
[05-1-F]Status methods: copy, save_state, restore Learn how to copy an object, save the object's current state (save_state), and restore it. copy manimlib.mobject.mobject.Mobject.copy(self) Copy the object. Returns: the cloned(copied) object If you need to create 100 Dots, you can create 100 new Dot objects, but you can also create one, specify the size and color, and then use copy method to create the rest. dots = VGroup(*[dot.copy() for i in ..
[05-1-E]Shape changing methods: scale, rotate 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 abou..
[05-1-D]Coloring methods: set_color, set_color_by_gradient You can specify the color of the object. Specifying a single color is set_color, giving a gradient, and specifying it is set_color_by_gradient. set_color manimlib.mobject.mobject.Mobject.set_color(self, color=YELLOW_C, family=True) Changes the object color to the specified value. For the color value, you can use the constant defined in constants.py file, or you can directly specify the color val..
[05-1-C]Aligning methods: align_to, arrange, arrange_in_grid align_to manimlib.mobject.mobject.Mobject.align_to(self, mobject_or_point, direction=ORIGIN) Arrange objects based on target objects or points. For example, if mob1.align_to(mob2, UP), move mob1 so that the upper line of mob1 and mob2 are the same. At this time, the other axis values of mob1 do not change and only move in the same direction as the upper line of mob2. Parameters: mobject_or_point..
[05-1-B]Dimensional methods: get_width/height/top, set_width/height get_width manimlib.mobject.mobject.Mobject.get_width(self) Gets the object's width, that is, the length in the x-axis direction. In Manim, the x-axis direction is between [-7.1, 7.1]. Therefore, the value of get_width is between [0,14.2] Returns: object's width value # Usage w = obj.get_width() set_width manimlib.mobject.mobject.Mobject.set_width(self, width, stretch=False, **kwargs) Change the ..
[05-1-A]Moving methods For the methods related to the movement of coordinates, please refer to [04]Coordinate. Next: [05-1-B]Dimensional methods: get_width/height/top, set_width/height [05-1-B]Dimensional methods: get_width/height/top, set_width/height get_width manimlib.mobject.mobject.Mobject.get_width(self) Gets the object's width, that is, the length in the x-axis direction. In Manim, the x-axis direction is betwe..
[05-1]Common methods of Mobject The superclass of all objects in Manim is Mobject. By inheriting this Mobject, classes such as text, shapes, graphs, and images are created. We'll cover how to deal with these classes in Chapter 05. Prior to this, in this chapter, we will first look at common methods that all objects have. It is a common method used in all objects, so it will be efficient to know here first. Common methods are d..
[05]Mobject In Mimim, there are classes that handle characters, formulas, and shapes that appear on the screen. This means that you need to use these classes when you want to display characters, formulas, and shapes on the screen. For example, to display the character 'Hello', you need to create an object using the Text class, such as text = Text("Hello"). Class and Object Classes and objects may not be wel..
[04-7] Examples: Object moving animation Let's make a simple animation showing the movement of a shape using to_edge and to_corner. The first screen is a dot on the left side, and this dot flies up/center/bottom of the wall on the right side. It's a simple animation, but if you follow the whole process of how to make a coding strategy for how to write these programming needs, and how to do the actual coding and execution, it will be a ..
[04-6] Move to relative position(shift) In the previous page, we looked at next_to, a method to move left/right/up/down based on an target object or position. In this chapter, we will learn about shift, a method that moves left/right/up/down from the position of object itself. Since we've only talked left/right/up/down, the next_to or shift method can be mistaken for only moving in these four directions, but can be moved in any direct..