CameraFollowCursorCV

class CodeVideoRenderer.renderer.CameraFollowCursorCV[source]

CameraFollowCursorCV is a class designed to create animated videos that simulate the process of typing code. It animates code line by line and character by character while smoothly moving the camera to follow the cursor, creating a professional-looking coding demonstration.

Parameters:
  • code (Union[Tuple[Literal['string'], str], Tuple[Literal['file'], StrPath]]) – The code to be animated. When using a string, provide a tuple with the first element as 'string' and the second element as the code string. When using a file, provide a tuple with the first element as 'file' and the second element as the file path.

  • language (PygmentsLanguage) – The programming language of the code.

  • formatter_style (PygmentsFormatterStyle) – The style for syntax highlighting. Defaults to "material".

  • line_spacing (Union[float, int]) – The line spacing for the code. Defaults to DEFAULT_LINE_SPACING.

  • interval_range (Tuple[Union[float, int], Union[float, int]]) – The range of typing intervals between characters. Defaults to (DEFAULT_TYPE_INTERVAL, DEFAULT_TYPE_INTERVAL).

  • camera_scale (Union[float, int]) – The scale factor for the camera. Defaults to 0.5.

  • video_name (str) – The name of the output video file. Defaults to "CameraFollowCursorCV".

  • renderer (Literal['cairo', 'opengl']) – The renderer to use for video rendering. Defaults to 'cairo'.

_create_scene()[source]

Create manim scene to animate code rendering.

render(output: bool = True)

Render the scene, optionally with console output.

Parameters:

output (bool) – Whether to print console output during rendering. Defaults to DEFAULT_OUTPUT_VALUE.

__getattribute__(name)[source]

Return getattr(self, name).