manim
manim copied to clipboard
DecimalNumber not following line
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:
