mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Rename frame_rate -> fps
This commit is contained in:
parent
fb3cf308df
commit
6decb0c32a
10 changed files with 21 additions and 21 deletions
|
@ -18,7 +18,7 @@ Frame and pixel shape
|
|||
|
||||
DEFAULT_PIXEL_HEIGHT = 1080
|
||||
DEFAULT_PIXEL_WIDTH = 1920
|
||||
DEFAULT_FRAME_RATE = 30
|
||||
DEFAULT_FPS = 30
|
||||
|
||||
Buffs
|
||||
-----
|
||||
|
|
|
@ -56,7 +56,7 @@ flag abbr function
|
|||
``--start_at_animation_number START_AT_ANIMATION_NUMBER`` ``-n`` Start rendering not from the first animation, but from another, specified by its index. If you passing two comma separated values, e.g. "3,6", it will end the rendering at the second value.
|
||||
``--embed LINENO`` ``-e`` Takes a line number as an argument, and results in the scene being called as if the line ``self.embed()`` was inserted into the scene code at that line number
|
||||
``--resolution RESOLUTION`` ``-r`` Resolution, passed as "WxH", e.g. "1920x1080"
|
||||
``--frame_rate FRAME_RATE`` Frame rate, as an integer
|
||||
``--fps FPS`` Frame rate, as an integer
|
||||
``--color COLOR`` ``-c`` Background color
|
||||
``--leave_progress_bars`` Leave progress bars displayed in terminal
|
||||
``--video_dir VIDEO_DIR`` Directory to write video
|
||||
|
|
|
@ -11,7 +11,7 @@ from scipy.spatial.transform import Rotation
|
|||
|
||||
from manimlib.constants import BLACK
|
||||
from manimlib.constants import DEGREES, RADIANS
|
||||
from manimlib.constants import DEFAULT_FRAME_RATE
|
||||
from manimlib.constants import DEFAULT_FPS
|
||||
from manimlib.constants import DEFAULT_PIXEL_HEIGHT, DEFAULT_PIXEL_WIDTH
|
||||
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
|
||||
from manimlib.constants import DOWN, LEFT, ORIGIN, OUT, RIGHT, UP
|
||||
|
@ -170,7 +170,7 @@ class Camera(object):
|
|||
"frame_config": {},
|
||||
"pixel_width": DEFAULT_PIXEL_WIDTH,
|
||||
"pixel_height": DEFAULT_PIXEL_HEIGHT,
|
||||
"frame_rate": DEFAULT_FRAME_RATE,
|
||||
"fps": DEFAULT_FPS,
|
||||
# Note: frame height and width will be resized to match
|
||||
# the pixel aspect ratio
|
||||
"background_color": BLACK,
|
||||
|
|
|
@ -136,7 +136,7 @@ def parse_cli():
|
|||
help="Resolution, passed as \"WxH\", e.g. \"1920x1080\"",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--frame_rate",
|
||||
"--fps",
|
||||
help="Frame rate, as an integer",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -427,10 +427,10 @@ def get_camera_configuration(args, custom_config):
|
|||
else:
|
||||
resolution = camera_resolutions[camera_resolutions["default_resolution"]]
|
||||
|
||||
if args.frame_rate:
|
||||
frame_rate = int(args.frame_rate)
|
||||
if args.fps:
|
||||
fps = int(args.fps)
|
||||
else:
|
||||
frame_rate = get_custom_config()["frame_rate"]
|
||||
fps = get_custom_config()["fps"]
|
||||
|
||||
width_str, height_str = resolution.split("x")
|
||||
width = int(width_str)
|
||||
|
@ -439,7 +439,7 @@ def get_camera_configuration(args, custom_config):
|
|||
camera_config.update({
|
||||
"pixel_width": width,
|
||||
"pixel_height": height,
|
||||
"frame_rate": frame_rate,
|
||||
"fps": fps,
|
||||
})
|
||||
|
||||
try:
|
||||
|
|
|
@ -10,7 +10,7 @@ FRAME_X_RADIUS = FRAME_WIDTH / 2
|
|||
|
||||
DEFAULT_PIXEL_HEIGHT = 1080
|
||||
DEFAULT_PIXEL_WIDTH = 1920
|
||||
DEFAULT_FRAME_RATE = 30
|
||||
DEFAULT_FPS = 30
|
||||
|
||||
SMALL_BUFF = 0.1
|
||||
MED_SMALL_BUFF = 0.25
|
||||
|
|
|
@ -48,4 +48,4 @@ camera_resolutions:
|
|||
high: "1920x1080"
|
||||
4k: "3840x2160"
|
||||
default_resolution: "high"
|
||||
frame_rate: 30
|
||||
fps: 30
|
|
@ -88,7 +88,7 @@ def compute_total_frames(scene_class, scene_config):
|
|||
pre_scene = scene_class(**pre_config)
|
||||
pre_scene.run()
|
||||
total_time = pre_scene.time - pre_scene.skip_time
|
||||
return int(total_time * scene_config["camera_config"]["frame_rate"])
|
||||
return int(total_time * scene_config["camera_config"]["fps"])
|
||||
|
||||
|
||||
def get_scenes_to_render(scene_classes, scene_config, config):
|
||||
|
|
|
@ -74,7 +74,7 @@ class Scene(object):
|
|||
from manimlib.window import Window
|
||||
self.window = Window(scene=self, **self.window_config)
|
||||
self.camera_config["ctx"] = self.window.ctx
|
||||
self.camera_config["frame_rate"] = 30 # Where's that 30 from?
|
||||
self.camera_config["fps"] = 30 # Where's that 30 from?
|
||||
self.undo_stack = []
|
||||
self.redo_stack = []
|
||||
else:
|
||||
|
@ -161,7 +161,7 @@ class Scene(object):
|
|||
self.skip_animations = False
|
||||
self.refresh_static_mobjects()
|
||||
while not self.is_window_closing():
|
||||
self.update_frame(1 / self.camera.frame_rate)
|
||||
self.update_frame(1 / self.camera.fps)
|
||||
|
||||
def embed(self, close_scene_on_exit: bool = True) -> None:
|
||||
if not self.preview:
|
||||
|
@ -469,7 +469,7 @@ class Scene(object):
|
|||
if self.skip_animations and not override_skip_animations:
|
||||
return [run_time]
|
||||
|
||||
times = np.arange(0, run_time, 1 / self.camera.frame_rate)
|
||||
times = np.arange(0, run_time, 1 / self.camera.fps)
|
||||
|
||||
if self.file_writer.has_progress_display:
|
||||
self.file_writer.set_progress_display_subdescription(desc)
|
||||
|
@ -628,7 +628,7 @@ class Scene(object):
|
|||
|
||||
def hold_loop(self):
|
||||
while self.hold_on_wait:
|
||||
self.update_frame(dt=1 / self.camera.frame_rate)
|
||||
self.update_frame(dt=1 / self.camera.fps)
|
||||
self.hold_on_wait = True
|
||||
|
||||
def wait_until(
|
||||
|
|
|
@ -97,9 +97,9 @@ class SceneFileWriter(object):
|
|||
|
||||
def get_resolution_directory(self) -> str:
|
||||
pixel_height = self.scene.camera.pixel_height
|
||||
frame_rate = self.scene.camera.frame_rate
|
||||
fps = self.scene.camera.fps
|
||||
return "{}p{}".format(
|
||||
pixel_height, frame_rate
|
||||
pixel_height, fps
|
||||
)
|
||||
|
||||
# Directory getters
|
||||
|
@ -234,7 +234,7 @@ class SceneFileWriter(object):
|
|||
self.final_file_path = file_path
|
||||
self.temp_file_path = stem + "_temp" + ext
|
||||
|
||||
fps = self.scene.camera.frame_rate
|
||||
fps = self.scene.camera.fps
|
||||
width, height = self.scene.camera.get_pixel_shape()
|
||||
|
||||
command = [
|
||||
|
|
|
@ -9,7 +9,7 @@ from rich import box
|
|||
from rich.console import Console
|
||||
from rich.prompt import Confirm
|
||||
from rich.prompt import Prompt
|
||||
from rich.rule import Rule
|
||||
from rich.rule import Rule
|
||||
from rich.table import Table
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
@ -64,7 +64,7 @@ def init_customization() -> None:
|
|||
"4k": "3840x2160",
|
||||
"default_resolution": "high",
|
||||
},
|
||||
"frame_rate": 30,
|
||||
"fps": 30,
|
||||
}
|
||||
|
||||
console = Console()
|
||||
|
|
Loading…
Add table
Reference in a new issue