让数学变得更生动manim库的使用(1)-基本概念

0、概述

数学理论与数学公式的展示总是一件很枯燥的事情,但3b1b的manim动画库在github上开源之后,让这一切变得非常简单。目前这个库已经分成两个版本一个由3b1b自身维护。但作者并没有承诺长期维护该库,所以由专门团队再次基础上研发了相应的社区版,并对该版本进行长期维护。本文的所有案例都基于社区版的官方案例。本文主要介绍该库的基本概念相关的案例,文章主要以代码为主,关键代码都有相关注释。

另外本文的运行环境维jupyter这与其他的ide环境运行代码稍微有些不同

1、类库引入已经相关测试

引入类库

from manim import *

1-1、shell命令格式

代码不能像传统python直接运行必须使用manim进行调用,命令格式如下

%manim -h
usage: manim file [flags] [scene [scene ...]]
       manim {cfg,init,plugins} [opts]

Animation engine for explanatory math videos

positional arguments:
  file                  Path to file holding the python code for the scene
  scene_names           Name of the Scene class you want to see

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT_FILE, --output_file OUTPUT_FILE
                        Specify the name of the output file, if it should be
                        different from the scene class name
  -p, --preview         Automatically open the saved file once its done
  -f, --show_in_file_browser
                        Show the output file in the File Browser
  --sound               Play a success/failure sound
  --leave_progress_bars
                        Leave progress bars displayed in terminal
  -a, --write_all       Write all the scenes from a file
  -w, --write_to_movie  Render the scene as a movie file (this is on by
                        default)
  -s, --save_last_frame
                        Save the last frame only (no movie file is generated)
  -g, --save_pngs       Save each frame as a png
  -i, --save_as_gif     Save the video as gif
  --disable_caching     Disable caching (will generate partial-movie-files
                        anyway)
  --flush_cache         Remove all cached partial-movie-files
  --log_
  • 3
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值