3b1b / 3b1b/manim

Clipping of rate function values in animations cause wiggle not to work properly

Đang mở
#1,140 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
93.8k
Fork
7.7k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Using code from 06/10, I could not get the following simple wiggle scene to render properly:
```
class test(Scene):
def construct(self):
dot = Dot(color=YELLOW)
self.add(dot)
self.play(dot.shift, RIGHT, rate_func=lambda t: wiggle(t,6),run_time=5)
self.wait(1)
```
The movement would occur in one direction as expected but not on the other. After digging into the code, I found the following lines in manimlib/animation/animation.py:
```
def get_sub_alpha(self, alpha, index, num_submobjects):
# TODO, make this more understanable, and/or combine
# its functionality with AnimationGroup's method
# build_animations_with_timings
lag_ratio = self.lag_ratio
full_length = (num_submobjects - 1) * lag_ratio + 1
value = alpha * full_length
lower = index * lag_ratio
return np.clip((value - lower), 0 1) # <---- could this be -1 instead of 0?
```
Since the wiggle function outputs values in the [-1, 1] interval, I fail to see how it's supposed to work with the above clipping in place. While I understand that it's supposed to be a safety net against wild user-provided rate functions, I believe it's better to extend the clipping to the [-1, 1] interval.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.