-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apply_complex_function HELP #3920
Comments
I don't completely understand what happens here, but if you scale down the amplitude of your randomness it gets better. Also a parametric curve for your circle seems to be a better choice, since a circle object in Manim does not contain many points. class Test(Scene):
def construct(self):
#circle = Circle()
circle = ParametricFunction(
lambda t: np.array([np.cos(t),np.sin(t),0]),
t_range=[0,2*PI,0.2]
)
# circle.apply_complex_function(
# lambda z: z*2
# )
circle.apply_complex_function(
lambda z: z*np.random.uniform(1.975, 2.025)
)
self.add(circle) |
Thanks @uwezi ,My purpose is to generate an irregular shape, and now I've found a way. from manim import *
import random
class IrregularShapeDemo(Scene):
stroke_color = TEAL
fill_color = BLUE_E
fill_opacity = 1
height = 2
def construct(self):
plane = NumberPlane()
blob = VMobject()
blob.set_points_as_corners([
(1 + 0.3 * random.random()) * p
for p in compass_directions(12)
])
blob.close_path()
blob.set_fill(self.fill_color, self.fill_opacity)
blob.set_stroke(self.stroke_color)
blob.set(height=self.height)
blob.make_smooth()
blob.center().shift(UP+RIGHT)
self.add(plane, blob) |
looks nice! I didn't know that already |
I wanted to turn the circle into an irregular shape by random scaling, as shown in Figure 1, but it didn't turn out what I wanted. Anyone can help me?
Figure 1
Result
The text was updated successfully, but these errors were encountered: