Skip to content

Instantly share code, notes, and snippets.

@uwezi
Last active December 10, 2025 18:48
Show Gist options
  • Select an option

  • Save uwezi/f6bf4d389fc56983f0c2cfa0dd56df6a to your computer and use it in GitHub Desktop.

Select an option

Save uwezi/f6bf4d389fc56983f0c2cfa0dd56df6a to your computer and use it in GitHub Desktop.
[Glow effect] Adding a blurry copy of an object. #manim #glow #shadow #PIL #bitmap
from PIL import Image, ImageFilter
class Scene2(MovingCameraScene):
def construct(self):
def blur_image(mobjs, blur=15, bright=1.2, scale_first=1.2):
scene = Scene()
render = scene.renderer
objs = VGroup(*[m.copy().scale(scale_first, about_point=m.get_center()) for m in mobjs])
render.camera.set_pixel_array(np.zeros_like(render.camera.pixel_array))
render.camera.capture_mobjects(objs)
img = render.camera.get_image()
img = img.filter(ImageFilter.GaussianBlur(blur))
img = img.point(lambda p: p * bright)
return ImageMobject(img).scale_to_fit_width(config["frame_width"]).move_to(ORIGIN)
planex = NumberPlane(
x_range=(-16, 16, 0.3),
y_range=(-9, 9, 0.3),
background_line_style={"stroke_color": GREY_C, "stroke_width":1, "stroke_opacity":0.3},
faded_line_style = dict(),
faded_line_ratio = 1
)
drone = SVGMobject("bilder/drone.svg")
glow = blur_image(drone, blur=20, bright=1.8, scale_first=1.15)
dg = Group(drone,glow)
dg.move_to(planex.c2p(2,3.5)) #This code brings warnings
self.add(dg)
self.play(FadeIn(planex))
self.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment