@@ -94,7 +94,6 @@ def construct(self):
94
94
from ..animation .animation import Animation
95
95
from ..animation .composition import Succession
96
96
from ..mobject .mobject import Group , Mobject
97
- from ..mobject .svg .svg_mobject import SVGMobject
98
97
from ..mobject .types .vectorized_mobject import VMobject
99
98
from ..utils .bezier import integer_interpolate
100
99
from ..utils .rate_functions import double_smooth , linear
@@ -303,8 +302,9 @@ class Write(DrawBorderThenFill):
303
302
vmobject
304
303
The VMobject to animate.
305
304
stroke_width
306
- Stroke width for drawing. If not given, for SVG-based mobjects (such as :class:`Text`, :class:`MarkupText`, or :class:`MathTex`)
307
- the stroke width is scaled relative to the font size. Others use 2.0.
305
+ Stroke width for drawing. If not provided, it is scaled based on font size
306
+ for text-based mobjects when the font is very small or very large;
307
+ otherwise defaults to 2.0.
308
308
rate_func
309
309
The function defining the animation progress.
310
310
reverse
@@ -386,10 +386,11 @@ def _adjust_stroke_width_for_text(
386
386
) -> float :
387
387
if stroke_width is not None :
388
388
return stroke_width
389
- if not isinstance (vmobject , SVGMobject ):
390
- return 2 # default in DrawBorderThenFill
391
389
font_size = getattr (vmobject , "font_size" , DEFAULT_FONT_SIZE )
392
- return (font_size / DEFAULT_FONT_SIZE ) * DEFAULT_STROKE_WIDTH * scale_factor
390
+ if font_size < 20 or font_size > 6 * DEFAULT_FONT_SIZE :
391
+ # Assuming the user is using MovingCameraScene and performing a zoom-in or zoom-out
392
+ return (font_size / DEFAULT_FONT_SIZE ) * DEFAULT_STROKE_WIDTH * scale_factor
393
+ return 2 # default in DrawBorderThenFill
393
394
394
395
def reverse_submobjects (self ) -> None :
395
396
self .mobject .invert (recursive = True )
0 commit comments