Skip to main content

A Python library for rendering code videos

Project description

V1.0.1.1

  • 更改打字时当前行的SurroundingRectangle样式

  • 增加打字时当前行的行号高亮

  • 新增scale参数,用于设置画面缩放


本库用于渲染并生成输入代码的视频,视频视角跟随光标移动。

*使用manim进行动画渲染,使用前请确保manim能够正常运行。

本库提供CodeVideo,你可以使用它创建一个视频对象。参数如下:

CodeVideo(video_name="CodeVideo", interval=0.05, floating_interval=True, floating_camera=True, 
          scale=0.3, paragraph_config={'font':'Consolas'}, **kwargs)

参数说明

video_name:用于设置视频名称,必须为字符串类型。

interval:用于设置每个字符之间的间隔(秒),必须为数值类型。

floating_interval:用于设置间隔是否上下浮动,如果为True则间隔会上下浮动0.01秒。

floating_camera:用于设置镜头是否上下浮动,如果为True则镜头会在上方0.05单位长度下方0.05单位长度间上下浮动。

scale:用于设置画面缩放。数越大画面越小。

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codevideorenderer-1.0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

CodeVideoRenderer-1.0.1.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file codevideorenderer-1.0.1.1.tar.gz.

File metadata

  • Download URL: codevideorenderer-1.0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for codevideorenderer-1.0.1.1.tar.gz
Algorithm Hash digest
SHA256 c08cc2caaf2408c9b0a8f5a41ef0eb8a08eca936afc430d826ede63c792571a7
MD5 a20bdc7acf318727526e74892f7da3c9
BLAKE2b-256 14814fa7a3e7bbe3c6e1bf0062246c27b4fec3f6ce9414d112e9ebd755b8830e

See more details on using hashes here.

File details

Details for the file CodeVideoRenderer-1.0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for CodeVideoRenderer-1.0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10fb739206d9702c4c399e6643b3babc8884c5017aa5f8555ed2b883bee47972
MD5 668c890df35c6b2470c0f7c62f18edc1
BLAKE2b-256 e54549df461af6d58db4236f39a85743b16c17b17c67f2e388a0e8468881b0d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page