MCPcopy
hub / github.com/ChrisBuilds/terminaltexteffects / new_path

Method new_path

terminaltexteffects/engine/motion.py:365–406  ·  view source on GitHub ↗

Create a new Path and add it to the Motion.paths dictionary with the path_id as key. Args: speed (float, optional): speed > 0. Defaults to 1. ease (easing.EasingFunction | None, optional): easing function for character movement. Defaults to None. layer (i

(
        self,
        *,
        speed: float = 1,
        ease: easing.EasingFunction | None = None,
        layer: int | None = None,
        hold_time: int = 0,
        loop: bool = False,
        path_id: str = "",
    )

Source from the content-addressed store, hash-verified

363 self.current_coord = coord
364
365 def new_path(
366 self,
367 *,
368 speed: float = 1,
369 ease: easing.EasingFunction | None = None,
370 layer: int | None = None,
371 hold_time: int = 0,
372 loop: bool = False,
373 path_id: str = "",
374 ) -> Path:
375 """Create a new Path and add it to the Motion.paths dictionary with the path_id as key.
376
377 Args:
378 speed (float, optional): speed > 0. Defaults to 1.
379 ease (easing.EasingFunction | None, optional): easing function for character movement. Defaults to None.
380 layer (int | None, optional): layer to move the character to, if None, layer is unchanged. Defaults to None.
381 hold_time (int, optional): number of frames to hold the character at the end of the path. Defaults to 0.
382 loop (bool, optional): Whether the path should loop back to the beginning. Default is False.
383 path_id (str, optional): Unique identifier for the path. Used to query for the path. Defaults to "".
384
385 Raises:
386 DuplicatePathIDError: If a path with the provided id already exists.
387 PathInvalidSpeedError: If `speed` is less than or equal to 0.
388
389 Returns:
390 Path: The new path.
391
392 """
393 if not path_id:
394 found_unique = False
395 current_id = len(self.paths)
396 while not found_unique:
397 path_id = f"{current_id}"
398 if path_id not in self.paths:
399 found_unique = True
400 else:
401 current_id += 1
402 if path_id in self.paths:
403 raise DuplicatePathIDError(path_id)
404 new_path = Path(path_id, speed, ease, layer, hold_time, loop)
405 self.paths[path_id] = new_path
406 return new_path
407
408 @typing.overload
409 def query_path(self, path_id: str) -> Path: ...

Callers 15

buildMethod · 0.80
build_line_effectsMethod · 0.80
buildMethod · 0.80
__next__Method · 0.80
buildMethod · 0.80
buildMethod · 0.80
prepare_blackholeMethod · 0.80
collapse_blackholeMethod · 0.80
explode_singularityMethod · 0.80
buildMethod · 0.80
add_characterMethod · 0.80

Calls 2

PathClass · 0.85