File size: 1,239 Bytes
1e3ce4c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | """Studio: orchestration shell for animation development.
The Studio class is a thin convenience facade. It holds no direct reference to
model code; every pixel mutation routes through pixel_cursor.PixelCursor.write_*.
Enable a backend by importing its adapter (e.g. studio.backends.motionclone) —
the adapter self-registers with pixel_cursor.ops.register_backend.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Iterable, Optional
from pixel_cursor import (
PixelCursor,
open_cursor,
Image,
FrameStack,
AnimationSegment,
load_image,
)
@dataclass
class Studio:
cursor: Optional[PixelCursor] = None
def load(self, image_path: str) -> "Studio":
img = load_image(image_path)
self.cursor = open_cursor(img)
return self
def with_cursor(self, cursor: PixelCursor) -> "Studio":
self.cursor = cursor
return self
def compile_24fps_from_keyframes(
self,
keyframe_cursors: Iterable[PixelCursor],
segments: Iterable[AnimationSegment],
) -> FrameStack:
from .compile_24fps import compile_keyframes
return compile_keyframes(keyframe_cursors, segments)
__all__ = ["Studio"]
|