Giter Club home page Giter Club logo

Comments (3)

uwezi avatar uwezi commented on September 13, 2024

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)

image

from manim.

guiwenfeng avatar guiwenfeng commented on September 13, 2024

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)

IrregularShapeDemo_ManimCE_v0 17 3

from manim.

uwezi avatar uwezi commented on September 13, 2024

looks nice!

I didn't know that already VMobject() had the method .make_smooth()

from manim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.