Code Monkey home page Code Monkey logo

Comments (7)

Elteoremadebeethoven avatar Elteoremadebeethoven commented on May 14, 2024 1

Solved here

from animationswithmanim.

Elteoremadebeethoven avatar Elteoremadebeethoven commented on May 14, 2024

As I explained in video 8.2 you cannot apply two Animation's classes to the same object, you must do it either using methods, or create a function and apply it with ApplyFunction (you can see it in my documentation), or creating a specific updater function. It is not a bug.

class Test(Scene):
    def construct(self):
        text = Text("Manim Animation", font="Arial", stroke_width=0,fill_opacity=0)

        def shift_and_fade(mob):
            mob.shift(UP)
            mob.set_fill(opacity=1)
            return mob
        self.play(
                LaggedStart(
                    ApplyFunction(shift_and_fade,text)
                )
        )
        self.wait()

from animationswithmanim.

qo4on avatar qo4on commented on May 14, 2024

You got me wrong. My code renders letter by letter. Your code creates different animation: the whole line appears at the same time. I mean suppose you have an AnimationGroup with some lagged start animation. Is there a way to animate shifting at the same time with this letter by letter animation I didn't find it in your tutorials?

class test(Scene):
    def construct(self):
        text = Text("Manim Animation", font="Arial", stroke_width=0)
        self.play(
            LaggedStartMap(FadeIn, text),
        )

from animationswithmanim.

Elteoremadebeethoven avatar Elteoremadebeethoven commented on May 14, 2024

Well in that case you can make use of what I tried to explain in those examples. You can do it in different ways:

class T1(Scene):
    def construct(self):
        text = Text("Manim Animation", font="Arial", stroke_width=0,fill_opacity=0)

        def shift_and_fade(mob):
            mob.shift(UP)
            mob.set_fill(opacity=1)
            return mob
        self.play(
                LaggedStart(*[ApplyFunction(shift_and_fade,t) for t in text])
        )
        self.wait()

class T2(Scene):
    def construct(self):
        text = Text("Manim Animation", font="Arial", stroke_width=0)

        self.play(
                LaggedStart(*[FadeInFromDown(t) for t in text])
        )
        self.wait()

class T3(Scene):
    def construct(self):
        text = Text("Manim Animation", font="Arial", stroke_width=0)

        self.play(
                LaggedStartMap(FadeInFromDown,text)
        )
        self.wait()

I recommend that you watch the videos "My projects" 1 and 2 for more examples of how to create your own animations like these.

from animationswithmanim.

qo4on avatar qo4on commented on May 14, 2024

Thanks, I understand all your examples. My question is a bit different. Is it possible to animate shifting of an AnimationGroup? I mean this is the video from one of your examples:

class test(Scene):
    def construct(self):
        text = Text("Manim Animation", font="Arial", stroke_width=0)
        anims = [FadeInFromPoint(obj, obj.get_center() * 1.4) for obj in text]
        self.play(LaggedStart(*anims))

Can I shift the whole animation and get this video? Animate letter by letter with an AnimationGroup and animate shifting of the whole line of text. Or any workaround if it's not possible?

It is useful when you already have some animation groups playing and you want to move them while they are still playing.

from animationswithmanim.

Elteoremadebeethoven avatar Elteoremadebeethoven commented on May 14, 2024

Sorry for the dalay, you can try somethink like this:

class Test(Scene):
    def construct(self):
        triangle = Triangle()
        square = Square()
        triangle.add_updater(lambda mob,dt: mob.shift(RIGHT*0.1))
        anim1 = Write(triangle)
        anim2 = Write(square)
        self.add(triangle)
        turn_animation_into_updater(anim1)
        self.wait(0.4)
        self.add(square)
        turn_animation_into_updater(anim2)
        self.wait(3)

from animationswithmanim.

qo4on avatar qo4on commented on May 14, 2024

Thank you! Unfortunately, updaters run forever. How can I apply smooth rate function to this triangle shifting to specific point (not shift forever) and change its run_time?

from animationswithmanim.

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.