Skip to main content

Function: applyToonShading()

applyToonShading(target, options): number

Defined in: src/rendering/toon/toonShading.ts:316

Apply the toon look (or remove it, for false) to every 3D mesh mobject in a tree. Use it for a Group of 3D mobjects, or pass a scene to style every mobject the scene holds now. Mobjects added later need their own call.

Parameters​

target​

ToonShadingTarget

A mobject, a list of mobjects, or a scene (anything with mobjects).

options​

A preset name, toon options, or false to turn the look off.

false | ToonShadingOptions | ToonPreset

Returns​

number

The number of 3D mobjects that changed.

Example​

const scene = new ThreeDScene(container);
scene.add(new Sphere({ color: BLUE, opacity: 0.5 }), new Torus({ color: TEAL }));
applyToonShading(scene); // manim look
applyToonShading(scene, 'cartoon'); // flat illustration, dark ink