Refactor set_color_by_radial_gradient & set_submobject_colors_by_radial_gradient#4664
Open
GoThrones wants to merge 8 commits intoManimCommunity:mainfrom
Open
Refactor set_color_by_radial_gradient & set_submobject_colors_by_radial_gradient#4664GoThrones wants to merge 8 commits intoManimCommunity:mainfrom
GoThrones wants to merge 8 commits intoManimCommunity:mainfrom
Conversation
…ial_gradient to include inner_radius, inner_color, outer_radius, outer_color
…ial_gradient to include inner_radius, inner_color, outer_radius, outer_color
for more information, see https://pre-commit.ci
…hrones/ManimCE into refactor/sscbradial_gradient
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview: What does this pull request change?
This PR changes 2 methods of mobject.py:
(1) set_colors_by_radial_gradient
(2) set_submobject_colors_by_radial_gradient
to include inner_radius and outer_radius.
This PR also writes docstring for the method set_colors_by_radial_gradient which was not there previosly.
Motivation and Explanation: Why and how do your changes improve the library?
In the main branch, in set_submobject_colors_by_radial_gradient, there was no provision to set the inner_radius from which the colouring will start, it was set to be centre of the mobject, which was not much helpful. In the PR, the default is the set to the mobject's centre, but the user can set an inner radius of choosing, from where to begin colouring radially outwards.
See the output:
This is code for and output from the main branch:
Output:

This is the code for and output from the PR branch:
output when inner_radius = 1.25:

Output when inner_radius = 0.0:

Output when inner_radius = 1.5 and outer_radius = 2.75:

Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist