(
cls,
run_time: float,
method: Callable[[Any], Any],
parameter_name: str = "run_time",
)
| 1098 | |
| 1099 | @classmethod |
| 1100 | def validate_run_time( |
| 1101 | cls, |
| 1102 | run_time: float, |
| 1103 | method: Callable[[Any], Any], |
| 1104 | parameter_name: str = "run_time", |
| 1105 | ) -> float: |
| 1106 | method_name = f"{cls.__name__}.{method.__name__}()" |
| 1107 | if run_time <= 0: |
| 1108 | raise ValueError( |
| 1109 | f"{method_name} has a {parameter_name} of " |
| 1110 | f"{run_time:g} <= 0 seconds which Manim cannot render. " |
| 1111 | f"The {parameter_name} must be a positive number." |
| 1112 | ) |
| 1113 | |
| 1114 | # config.frame_rate holds the number of frames per second |
| 1115 | fps = config.frame_rate |
| 1116 | seconds_per_frame = 1 / fps |
| 1117 | if run_time < seconds_per_frame: |
| 1118 | logger.warning( |
| 1119 | f"The original {parameter_name} of {method_name}, " |
| 1120 | f"{run_time:g} seconds, is too short for the current frame " |
| 1121 | f"rate of {fps:g} FPS. Rendering with the shortest possible " |
| 1122 | f"{parameter_name} of {seconds_per_frame:g} seconds instead." |
| 1123 | ) |
| 1124 | run_time = seconds_per_frame |
| 1125 | |
| 1126 | return run_time |
| 1127 | |
| 1128 | def get_run_time(self, animations: list[Animation]) -> float: |
| 1129 | """ |
no outgoing calls
no test coverage detected