Skip to content

Conversation

pedropxoto
Copy link
Contributor

@pedropxoto pedropxoto commented Jun 10, 2025

Overview: What does this pull request change?


Fixes #4031

Change code snipped to “Creating a custom animation” page in documentation

In detail:

  • It was given an example that allows the usage of the rate_func parameter to work in a custom animation.

Motivation and Explanation: Why and how do your changes improve the library?


The code snippet provided in the current documentation contains a parameter that does not influence the behavior of the generated animation. The segment rate_func=linear in the line of code self.play(Count(number, 0, 100), run_time=4, rate_func=linear) can be modified or removed, as it does not affect the animation produced in the example.

For the animation style (speed curves for animations) to be effectively modified by the parameter, it is required to invoke self.rate_func() on the alpha value. This allows the animation style to be altered through the rate_func parameter in the self.play() method.

Links to added or changed documentation pages


Manim’s building blocks > Creating a custom animation

Further Information and Comments


The difficulty arises because the rate_func is implemented within the interpolate_object method. When this method is overridden, the call to rate_func is omitted. Therefore, passing rate_func as an argument to a custom animation has no effect. By including self.rate_func(alpha), the variation function is applied to the alpha value, causing it to vary according to the specified function.

Reviewer Checklist


  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@github-project-automation github-project-automation bot moved this to 🆕 New in Dev Board Jun 10, 2025
@behackl behackl added the documentation Improvements or additions to documentation label Jun 11, 2025
Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does make it clearer; thank you very much for your contribution!

@github-project-automation github-project-automation bot moved this from 🆕 New to 👍 To be merged in Dev Board Jun 11, 2025
@behackl behackl merged commit be6a9df into ManimCommunity:main Jun 11, 2025
21 checks passed
@github-project-automation github-project-automation bot moved this from 👍 To be merged to ✅ Done in Dev Board Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Rate function usage for custom animations in the docs is unclear/misleading

2 participants