DecimalNumber#
Qualified name: manim.mobject.text.numbers.DecimalNumber
- class DecimalNumber(number=0, num_decimal_places=2, mob_class=<class 'manim.mobject.text.tex_mobject.MathTex'>, include_sign=False, group_with_commas=True, digit_buff_per_font_unit=0.001, show_ellipsis=False, unit=None, include_background_rectangle=False, edge_to_fix=array([-1., 0., 0.]), font_size=48, stroke_width=0, fill_opacity=1.0, **kwargs)[source]#
Bases:
VMobject
An mobject representing a decimal number.
Examples
Example: MovingSquareWithUpdaters ¶
from manim import * class MovingSquareWithUpdaters(Scene): def construct(self): decimal = DecimalNumber( 0, show_ellipsis=True, num_decimal_places=3, include_sign=True, ) square = Square().to_edge(UP) decimal.add_updater(lambda d: d.next_to(square, RIGHT)) decimal.add_updater(lambda d: d.set_value(square.get_center()[1])) self.add(square, decimal) self.play( square.animate.to_edge(DOWN), rate_func=there_and_back, run_time=5, ) self.wait()
Methods
get_value
increment_value
Set the value of the
DecimalNumber
to a new number.Attributes
animate
Used to animate the application of any method of
self
.animation_overrides
color
depth
The depth of the mobject.
fill_color
If there are multiple colors (for gradient) this returns the first one
The font size of the tex mobject.
height
The height of the mobject.
n_points_per_curve
sheen_factor
stroke_color
width
The width of the mobject.
- Parameters
number (float) –
num_decimal_places (int) –
mob_class (VMobject) –
include_sign (bool) –
group_with_commas (bool) –
digit_buff_per_font_unit (float) –
show_ellipsis (bool) –
unit (str | None) –
include_background_rectangle (bool) –
edge_to_fix (Sequence[float]) –
font_size (float) –
stroke_width (float) –
fill_opacity (float) –
- property font_size#
The font size of the tex mobject.
- set_value(number)[source]#
Set the value of the
DecimalNumber
to a new number.- Parameters
number (float) – The value that will overwrite the current number of the
DecimalNumber
.