manim icon indicating copy to clipboard operation
manim copied to clipboard

DecimalNumber not following line

Open Dogacel opened this issue 4 years ago • 0 comments

Describe the bug

When a DecimalNumber is set next_to a line, it doesn't follow. The behavior is different when you add a Brace. Try uncommenting the lines related to Brace, you will see that the number is following it even though the number is not following the Brace.

Code:

SCALE = 3
plane = NumberPlane((-2, 2),(-2, 2)).scale(SCALE)
plane.set_stroke(BLUE_E, 1)

self.add(plane)

p1 = Point(plane.c2p(1,0))    
line = Line(plane.get_origin(), p1.get_location()).set_stroke(GREEN_E, 2)

# brace = always_redraw(Brace, line, UP)

distance = DecimalNumber(0, num_decimal_places=2, font_size=24)
distance.arrange(RIGHT)

always(distance.next_to, line, UP)
f_always(distance.set_value, lambda : line.get_length() / SCALE)
# f_always(brace.rotate, line.get_angle)

self.add(distance)
# self.add(brace)

self.play(
    ShowCreation(line)
)


for x in range(360//15)
    self.play(
        line.animate.set_angle(line.get_angle() + 15 * DEGREES)
    )
    self.wait(0.2)

Wrong display or Error traceback:

with_brace without_brace

Additional context

Dogacel avatar Dec 27 '21 09:12 Dogacel