FlubberMorpher
Flubber-based shape interpolator with reference-counted caching.
Uses the static 'for_paths' factory method to manage a global instance cache. Multiple calls to for_paths() with the same shapes return the same instance, and the instance is only cleaned up when all references call close().
Constructor
FlubberMorpher(
path1: SVGPath,
path2: SVGPath,
cache_key: Tuple[str, str, str],
max_cache_size: Optional[int] = None,
kwargs: Any
)
Constructor. Executes the expensive Node.js bridge initialization.
Parameters
-
path1 - Start shape
-
path2 - End shape
-
cache_key - Tuple used for cache lookup
-
**kwargs - Options for FlubberNodeBridge
Methods
cache_stats
cache_stats()
Get statistics about the global morpher cache.
Returns
Dict with cache size, active instances, total references
cleanup
cleanup()
Force cleanup of all cached morphers regardless of reference counts.
clear_cache
clear_cache()
Alias for cleanup(). Clear all cached morphers.
close
close()
Decrement reference count and cleanup if this is the last reference.
for_paths
for_paths(
path1: SVGPath,
path2: SVGPath,
kwargs: Any
) -> FlubberMorpher
Factory method that returns a cached morpher instance.
Parameters
-
path1 - Start shape
-
path2 - End shape
-
**kwargs - Options passed to FlubberNodeBridge (e.g., flubber_path)
Returns
FlubberMorpher instance (possibly cached)
get_cache_stats
get_cache_stats()
Get statistics about the t-value cache performance.
Returns
Dictionary with cache statistics