Comments (2)
This has been discussed on Discord: https://discord.com/channels/581738731934056449/1173280309601636483/1173280309601636483
The solution presented there is by cloning your objects which are supposed to cast a shadow. Implementing a true blurred shadow is not easy given how objects and scenes are rendered in Manim.
def add_shadow(mobject, color=BLACK, opacity=0.2, shift=(0.2, -0.2, 0)):
shadow = (mobject.copy()
.set_fill(color, opacity=opacity)
.set_stroke(width=0)
.shift(shift)
.set_z_index(-1)
)
mobject.add(shadow)
return mobject
config.background_color = WHITE
class Test(Scene):
def construct(self):
card = Rectangle(height=3, width=4.5, fill_opacity=1, fill_color=WHITE, stroke_color=BLACK)
circle = Circle(radius=1, fill_opacity=1, fill_color=WHITE, stroke_color=RED).to_corner(UL)
star = Star(n=5, fill_opacity=1, fill_color=WHITE, stroke_color=BLUE).next_to(circle, RIGHT)
add_shadow(card)
add_shadow(circle)
add_shadow(star)
self.add(card, circle, star)
from manim.
There is also another message on Discord by a user who claims that he has developed a drop-shadow in Manim back in 2022, but he seems to have never shared his code:
https://discord.com/channels/581738731934056449/581738732646957057/958273360612192256
from manim.
Related Issues (20)
- get_nth_subpath can return List instead of expected type of NDArray.
- StopIteration Exception in earclip_triangulation
- Could not build wheels for Pillow HOT 1
- Sector.get_arc_center() return a reference but not a copy, cause rotate unexpected behavior.
- SVG rounded caps/joins are rendered as sharp HOT 2
- Increasing Latex compatibility to make Manim more powerful
- MarkupText ul tag does not work HOT 2
- ManimColor YELLOW_C is inconsistent with other colors.
- Creating graph edges individually doesn't show animation
- ModuleNotFoundError: No module named 'pkg_resources' HOT 2
- Cannot render text normally HOT 9
- Hyperlinks to methods without a docstring do not work.
- The line of NumberLine disappears when applying a LaggedStart on its components HOT 2
- Getting error for dvisvgm HOT 2
- `align_to` misbehavior after `move_to` HOT 3
- `to_edge` doesn't seem to respect my `--resolution` flags HOT 2
- IndexError: list index out of range HOT 3
- Problems with preparing metadata for skia-pathops HOT 1
- Setting config.background_opacity to 0 crashes the writing pipe without the -t flag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manim.