mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Partial completion of TwoDBoxWithSliders in highD.py
This commit is contained in:
parent
dca46ba2e8
commit
a765a64bc7
4 changed files with 912 additions and 27 deletions
|
@ -80,6 +80,8 @@ class TexMobject(SVGMobject):
|
|||
if tex in ["\\over", "\\overline"]:
|
||||
#fraction line needs something to be over
|
||||
tex += "\\,"
|
||||
if tex == "\\sqrt":
|
||||
tex += "{\\quad}"
|
||||
for t1, t2 in ("\\left", "\\right"), ("\\right", "\\left"):
|
||||
should_replace = reduce(op.and_, [
|
||||
t1 in tex,
|
||||
|
|
|
@ -32,7 +32,7 @@ class NumberLine(VMobject):
|
|||
|
||||
def generate_points(self):
|
||||
self.main_line = Line(self.x_min*RIGHT, self.x_max*RIGHT)
|
||||
self.tick_marks = VMobject()
|
||||
self.tick_marks = VGroup()
|
||||
self.add(self.main_line, self.tick_marks)
|
||||
for x in self.get_tick_numbers():
|
||||
self.add_tick(x, self.tick_size)
|
||||
|
|
|
@ -12,7 +12,7 @@ class DecimalNumber(VMobject):
|
|||
}
|
||||
def __init__(self, float_num, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
num_string = '%.*f' % (self.num_decimal_points, float_num)
|
||||
num_string = '%.*f'%(self.num_decimal_points, float_num)
|
||||
VMobject.__init__(self, *[
|
||||
TexMobject(char)
|
||||
for char in num_string
|
||||
|
@ -64,7 +64,10 @@ class ChangingDecimal(Animation):
|
|||
|
||||
def update_number(self, alpha):
|
||||
decimal = self.decimal_number
|
||||
new_decimal = DecimalNumber(self.number_update_func(alpha))
|
||||
new_decimal = DecimalNumber(
|
||||
self.number_update_func(alpha),
|
||||
num_decimal_points = self.num_decimal_points
|
||||
)
|
||||
new_decimal.replace(decimal, dim_to_match = 1)
|
||||
new_decimal.highlight(decimal.get_color())
|
||||
decimal.align_data(new_decimal)
|
||||
|
|
Loading…
Add table
Reference in a new issue