3b1b / 3b1b/manim

DecimalNumber not following line

Open
#1,700 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
93.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

### 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**:
```python
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](https://user-images.githubusercontent.com/7023385/147456546-500d6456-df7e-4051-8c9c-5b6022bc7d04.png)
![without_brace](https://user-images.githubusercontent.com/7023385/147456550-51b07883-8943-4e21-827d-33a6656d1185.png)

### Additional context

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.