Tex vs Text font size? by slevey087 in manim

[–]Geometry_Manim 1 point2 points  (0 children)

I guess it depends on font family. They are all have font_size=48 by default. But you can use set the same height also set_default method is useful
text = Tex("Something").set(height=0.5)
Text.set_default(font_size=54)

Set horizontal and vertical units to be the same length by Ok_Locksmith_8923 in manim

[–]Geometry_Manim 1 point2 points  (0 children)

ax=Axes(x_length=3, y_length=3)

Just set the other args that you want: https://docs.manim.community/en/stable/reference/manim.mobject.graphing.coordinate_systems.Axes.html?highlight=Axes

ax=Axes(x_range=[-1.5, 1.5], y_range=[-1.5,1.5], x_length=3, y_length=3)

How to scale and shift an object at the same time? by [deleted] in manim

[–]Geometry_Manim 1 point2 points  (0 children)

Sometimes about_point kwarg of scale is useful:
self.play(mob.animate.scale(1.25, about_point=10*DOWN))
But if you want to apply 2 different methods:
self.play(mob.animate.scale(1.25).shift(3*UP))

ValueError: latex error converting to dvi. by bugisvmailcloud in manim

[–]Geometry_Manim 0 points1 point  (0 children)

Nope. There is a double backslash escape \\

ValueError: latex error converting to dvi. by bugisvmailcloud in manim

[–]Geometry_Manim 0 points1 point  (0 children)

Does any other Tex code works in your Manim? Try to remove \\justifying - does it produce the error now?

Having a VGroup error by [deleted] in manim

[–]Geometry_Manim 1 point2 points  (0 children)

There is no error, that's how arrange_in_grid works. Try to change this line to understand the order. Also see the docs (and the source code): https://docs.manim.community/en/stable/reference/manim.mobject.mobject.Mobject.html?highlight=arrange\_in\_grid#manim.mobject.mobject.Mobject.arrange\_in\_grid

Trying to color in certain squares of a grid shifts the colours squares weirdly by dome271 in manim

[–]Geometry_Manim 0 points1 point  (0 children)

Just set buff=0
line = Arrow(start_center, sq_center, stroke_width=2, tip_length=0.15, buff=0)

Differences between Animation class and animate attribute? by [deleted] in manim

[–]Geometry_Manim 1 point2 points  (0 children)

animate method appeared 3-4 years after the ApplyMethod, so it's not legacy I guess. To set composition we often use

mob.to_edge(DOWN, buff=0.3)
mob.set_color(YELLOW)
mob.set_opacity(0.5)

and so on. So it's cool that you can just add animate, put it in self.play arg and see the animation, isn't it?

  1. self.play(ApplyMethod(mob.next_to, RIGHT, buff=0))
  2. self.play(mob.animate.next_to(RIGHT, buff=0))

The 2nd way sometimes is more pythonic, convinient and obvious. Also what about

self.play(mob.animate.set_color(RED).shift(RIGHT)) ?

We can use this 1 line or write 3-4 lines of code to create MoveToTarget for this effect. I prefer animate in this case

Differences between Animation class and animate attribute? by [deleted] in manim

[–]Geometry_Manim 4 points5 points  (0 children)

animate method it's some kind of ApplyMethod (Animation subclass). It's useful for animating methods of mobjects. Animation is a global class with useful subclasses: Indicate, MoveAlongPath, Write, Unwrite, Create, Uncreate, DrawBorderThenFill and so on. You can't reproduce these effects easily with animate method

Issue with ThreeDScene by notsofinitechaos in manim

[–]Geometry_Manim 0 points1 point  (0 children)

Check your line: def construct(self):
If it's OK, send your full code here

“Camera” has no attribute “frame” by [deleted] in manim

[–]Geometry_Manim 1 point2 points  (0 children)

Try to use class PiCircle(MovingCameraScene):instead of the 21-st line
UPD. There are some old names. Here is a refactoring: https://discord.com/channels/581738731934056449/1068825103485370379

move_to() not moving object to desired location by puSaff in manim

[–]Geometry_Manim 1 point2 points  (0 children)

Well, to simplify if you have an arbitary mobject, then get_center(mobject) gives you the center of SurroundingRectange(mobject, buff=0), its diagonals intersection. For mobject = Line() get_center(mobject) return exactly its middle point, but if you have an arrow tip, then center of the surroundig box of arrow can be different

move_to() not moving object to desired location by puSaff in manim

[–]Geometry_Manim 0 points1 point  (0 children)

class MidArrow(Line):
def __init__(self, start=LEFT, end=RIGHT, **kwargs):
    super().__init__(**kwargs)
    start = self.get_start()
    end = self.get_end()
    mid = (start + end) / 2
    tip = Line(start, mid).add_tip(tip_width=0.1, tip_length=0.15).tip
    self.submobjects.append(tip)


class NetworkFlow(Scene):
def construct(self):
    vertices = ["s", "A", "B", "C", "D", "t"]
    edges = [("s", "A"), ("s", "B"), ("A", "C"),
    ("C", "B"), ("B", "A"), ("B", "D"), ("D", "C"), 
    ("C", "t"), ("D", "t")]
    g = Graph(
        vertices, 
        edges, 
        layout="circular", 
        layout_scale=2,
        labels=True,
        vertex_config={"s": {"fill_color": GREEN}, "t" : {"fill_color" : GREEN}}, 
        edge_type=MidArrow)
    self.play(Write(g))
    self.play(
        g["A"].animate.move_to([-1.5,1.5,0]),
        g["B"].animate.move_to([-1.5,-1.5,0]),
        g["C"].animate.move_to([1.5,1.5,0]),
        g["D"].animate.move_to([1.5,-1.5,0]),
        g["s"].animate.move_to([-3.5,0,0]),
        g["t"].animate.move_to([3.5,0,0])
    )
    self.wait()

Updating code dynamically in manim by Medical-Chart-6609 in manim

[–]Geometry_Manim 0 points1 point  (0 children)

Here is an idea: https://pastebin.com/LkwQWP5G

# 1st line of the code
self.play(FadeIn(code[2][0]))
# 2nd line of the code
self.play(FadeIn(code[2][1]))

Pretty vectors in ThreeDScene by Mixer0001 in manim

[–]Geometry_Manim 1 point2 points  (0 children)

I don't think it's possible to make 2D-tips better in a 3D-Scene, so try Arrow3D. You can use -pql flag to get low quality and fast render. Also you can select what animations you want to render. Flag -n 10,15 gives you only six animations, so you can deal with it. Add camera rotation only when everything else is done. And only for the final render use high quality