the PathFromPoints class not find #3848
Answered
by
jengelbertt
jengelbertt
asked this question in
Q&A
-
This code is placed here by MrDiver. But it doesn't work for me. I do not have the specified classes(PathFromPoints,AttachHandlesAttachHandles). I use manim version 18. What should I do to solve the problem? class TracePathExample(Scene):
|
Beta Was this translation helpful? Give feedback.
Answered by
jengelbertt
Jul 10, 2024
Replies: 1 comment 6 replies
-
a) I showed you yesterday how to correctly place code here.... b) Where exactly, when and in which context did MrDiver post this code? (link?) c) Here is a working version: class TracePathExample(Scene):
def construct(self):
title = Tex("TracePathExample").to_edge(UP)
self.add(title)
xs = np.linspace(0,PI*2,5)
def f(t):
return [t,np.cos(t),0]
# return np.random.random_integers(-2,2,size=3)
ys = [f(t) for t in xs]
#path = PathFromPoints(ys).make_smooth()
#handles = AttachHandles(path)
path = VMobject().set_points_smoothly(ys)
offset = ValueTracker(0)
dots = []
traces = []
n = 2
for i in range(n):
def get(i):
dot = Dot().add_updater(lambda m: m.move_to(path.point_from_proportion((offset.get_value()+i/n)%1)))
trace = TracedPath(lambda : path.point_from_proportion((offset.get_value()+i/n)%1), dissipating_time=0)
return dot,trace
dot,trace = get(i)
dots.append(dot)
traces.append(trace)
# square.add_updater(lambda m: m.become(square.animate.trace_path()))
# self.add(path)
self.add(dots[0], traces[0]) #, handles)
self.play(offset.animate.set_value(1), run_time=3, rate_func=linear)
self.wait() TracePathExample.mp4 |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am glad that manim community has a person like you. Thank you. you are amazing