A Python library for rendering code videos
Project description
本库用于渲染并生成输入代码的视频,视频视角跟随光标移动。
说明
使用manim进行动画渲染,使用前请确保manim能够正常运行。
如何使用
本库提供CodeVideo函数,你可以使用它创建一个视频对象。参数如下:
CodeVideo(video_name="CodeVideo", speed=0.2, interval=0.05, floating_interval=True,
floating_pos=True, paragraph_config={'font':'Consolas'}, **kwargs)
参数说明
video_name:用于设置视频名称,必须为字符串类型。
speed:用于设置每个字符停留时间(秒),必须为数值类型。
interval:用于设置每个字符之间的间隔(秒),必须为数值类型。
floating_interval:用于设置间隔是否上下浮动,如果为True则间隔会上下浮动0.01秒。
floating_pos:用于设置镜头是否上下浮动,如果为True则镜头会在上方0.05单位长度和下方0.05单位长度间上下浮动。
paragraph_config:Manim原版参数,原设置为None,更改为常用编程字体Consolas。
**kwargs:可以传入Manim原版Code代码块中的其余参数,详见Code。
生成视频
你可以对CodeVideo对象使用 render方法进行视频生成,你可以在终端查看视频的保存位置。
示例
from CodeVideoRenderer import *
video = CodeVideo(code_string="print('Hello World!')", language='python')
video.render()
渲染结果
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codevideorenderer-1.0.0.2.tar.gz.
File metadata
- Download URL: codevideorenderer-1.0.0.2.tar.gz
- Upload date:
- Size: 26.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38004196f9344f07f94878fe1aa4371c4d0ded4347d78169f53c9734fd0283eb
|
|
| MD5 |
802b446b4e17b38be5c930b271d14762
|
|
| BLAKE2b-256 |
b9217ac13b4da70978529a09ab32720d02fc291237998c53b2cea68f7caac97c
|
File details
Details for the file CodeVideoRenderer-1.0.0.2-py3-none-any.whl.
File metadata
- Download URL: CodeVideoRenderer-1.0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e08f66af366c3d1d265d69259aef7145e2eb3028e559b39791dcf7b25399c93
|
|
| MD5 |
7417cdc9d2bed2c19f59986d06b4ae4a
|
|
| BLAKE2b-256 |
31e9a47b2c9e8b1c16f9594d161cadb530b5f704a60981e120361e937cb1e7f2
|