New Feature: Added support for Radial Gradient - #4941
Open
UnMolDeQuimica wants to merge 6 commits into
Open
Conversation
Author
|
I recently added another PR with modifications to support the from manim import *
class GradientExample(Scene):
def construct(self):
gradient = color_gradient(
[
ManimColor("#f7f7b6"),
ManimColor("#ffff00"),
ManimColor("#ffff00", alpha=0),
ManimColor("#ffff00", alpha=0),
ManimColor("#ffff00", alpha=0),
],
5
)
self.add(
Circle(
radius=4,
fill_color=gradient,
fill_opacity=1,
gradient_type=GradientType.RADIAL,
stroke_opacity=0,
)
)
|
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?
Adds support for radial gradients with Cairo renderer.
Motivation and Explanation: Why and how do your changes improve the library?
Currently, ManimCE supports only linear gradients and it supports them in a very clunky way. In this PR I add a small step towards improving how gradients work by adding a
GradientTypeenum and implementing support for radial gradients.Here's an example of what can be done with these changes:
This example is added to the documentation.
Links to added or changed documentation pages
GradientType documentation
Updated VMobject documentation
Further Information and Comments
All tests pass as I made it use the
LINEARgradient type by default to support existing code.Reviewer Checklist
Small note: I did not add tests, just ran existing tests and tried a few combinations