echo Hello World!
https://docs.manim.community/en/stable/examples.html
docker pull manimcommunity/manim
https://manim-video-generator.sevalla.app/
https://try.manim.community/
https://mybinder.org/
manim documentation
https://docs.devtaoism.com/docs/html/contents/_2_basic_mobjects.html#vmobject-attributes
data race video
from manim import *
config.background_color = RED
config.frame_rate = 25
config.frame_size = [1200,500] # [WIDTH, HEIGHT]
# config.transparent = True
# RENDER AS IMAGE: ----------------
config.format = "png"
config.save_last_frame = True
# config.transparent = True
# REDER AS GIF: -------------------
config.format = "gif"
股票行情
https://efinance.readthedocs.io/en/latest/install.html
https://livingcharts.com/app/edit/pr1ocsyuf0SRGlDssPLs
https://app.flourish.studio/visualisation/24950498/edit
colab : https://colab.research.google.com/github/Isi-dev/Google-Colab_Notebooks/blob/main/Wan2_1_14B_I2V_GGUF_Free.ipynb#scrollTo=wo8w6tKerJMJ
!sudo apt update
!sudo apt install libcairo2-dev ffmpeg \
texlive texlive-latex-extra texlive-fonts-extra \
texlive-latex-recommended texlive-science \
tipa libpango1.0-dev
!pip install manim
!pip install IPython==8.21.0
!sudo apt-get install -y texlive-lang-chinese
from manim import *
!pip install efinance
import efinance as ef
stock_code = '300414'
ef.stock.get_quote_history(stock_code)
# Export the specific day data to an Excel file
specific_day_data.to_excel('specific_day_stock_data.xlsx', index=False)
import efinance as ef
stock_code = '300414'
ef.stock.get_quote_history(stock_code)
print("Specific day stock data exported to 'specific_day_stock_data.xlsx'")
def construct(self):
nl = NumberLine(include_numbers=True)
selector = Triangle(fill_opacity=1,color=RED).scale(0.2).rotate(PI/3)
dn = DecimalNumber(0)
update_grp = VGroup(selector, dn)
def update_vgrp(vgrp):
s,d = vgrp
s.next_to(nl.n2p(dn.get_value()),UP,buff=0)
d.next_to(selector,UP,buff=0.1)
update_grp.add_updater(update_vgrp)
self.add(nl,update_grp) # <-- add grp complete, not each element
# Not use self.add(nl, selecttor, dn)
self.wait(0.5)
self.play(
ChangeDecimalToValue(dn, 4),
run_time=2
)
self.wait(0.5)
self.play(
ChangeDecimalToValue(dn, -1),
run_time=2
)
self.wait(0.5)
self.play(
ChangeDecimalToValue(dn, -4),
run_time=2
)
self.wait(0.5)
self.play(
ChangeDecimalToValue(dn, 7),
run_time=3
)
self.wait(0.5)
%%manim -qm CodeFromString
class CodeFromString(Scene):
def construct(self):
code = '''from manim import Scene, Square
class CodeLines(BasicCodeMobject):
def modify_code(self, code):
lines = code[2:]
colors = it.cycle([RED, TEAL, PURPLE, BLUE])
for line in lines:
line.set_color(next(colors))
'''
rendered_code = Code(
code_string=code, tab_width=4, background="window",
language="python"
)
# 创建高亮框
highlight_rect = Rectangle(
height=0.35,
width=rendered_code.width - 0.2,
stroke_color=YELLOW,
stroke_width=3,
fill_color=YELLOW,
fill_opacity=0.2
)
# 初始显示代码
self.play(FadeIn(rendered_code))
self.wait(0.5)
# 逐行高亮执行
for i in range(len(rendered_code)):
# 移动高亮框到当前行
highlight_rect.next_to(rendered_code[i], LEFT, aligned_edge=LEFT)
self.play(
Create(highlight_rect) if i == 0 else highlight_rect.animate.move_to(
rendered_code[i].get_center() + UP * rendered_code[i].height/2
),
run_time=0.3
)
self.wait(0.3) # 每行停留0.3秒
# 可选:添加当前行的强调效果
self.play(
rendered_code[i].animate.set_color(RED),
run_time=0.1
)
self.play(
rendered_code[i].animate.set_color(WHITE),
run_time=0.1
)
# 移除高亮框
self.play(FadeOut(highlight_rect), run_time=0.3)
self.wait(2)
indications = [
# Indications that need only the Mobject to be highlighted
ApplyWave,
Circumscribe,
FocusOn,
Indicate,
Wiggle,
# Indications that need another argument
ShowPassingFlash, # This needs a background Mobject, such as Underline or a VMobject with surround
Flash, # This needs a coord
]
names = [Tex(i.__name__).scale(3) for i in indications]
#for i in indications
install manim on. mac
pip3 install manim
%%manim -qm CodeFromString
class CodeFromString(Scene):
def construct(self):
code = '''from manim import Scene, Square
class CodeLines(BasicCodeMobject):
def modify_code(self, code):
lines = code[2:]
colors = it.cycle([RED, TEAL, PURPLE, BLUE])
for line in lines:
line.set_color(next(colors))
'''
rendered_code = Code(
code_string=code, tab_width=4, background="window",
language="swift", paragraph_config=dict(font="Monospace")
)
self.play(FadeIn(rendered_code[0]))
self.play(FadeIn(rendered_code[1]))
textt = MarkupText('<gradient from="green" to="yellow">大中国hello amazing</gradient>')
# self.play(FadeIn(rendered_code))
# self.play(Create(SurroundingRectangle(rendered_code[2:][0][6],color=RED)))
for line in rendered_code[2:][0]:
self.play(FadeIn(line))
self.play(Create(textt))
self.wait(2)