8 from ..nvector
import NVector, Point
12 with glaxnimate.environment.Headless():
13 document = glaxnimate.model.Document(
"")
14 glaxnimate.io.registry.from_slug(
"lottie").load(document, json.dumps(animation.to_dict()).encode(
"utf8"))
15 return glaxnimate.io.registry.from_slug(exporter_slug).save(document)
19 with glaxnimate.environment.Headless():
20 document = glaxnimate.model.Document(
"")
21 glaxnimate.io.registry.from_slug(
"lottie").load(document, json.dumps(animation.to_dict()).encode(
"utf8"))
22 document.current_time = time
23 return glaxnimate.io.registry.serializer_from_slug(serializer_slug).
serialize([document.main])
27 def __init__(self, animation, serializer_slug, dpi):
28 self.
contextcontext = glaxnimate.environment.Headless()
38 self.
documentdocument = glaxnimate.model.Document(
"")
39 glaxnimate.io.registry.from_slug(
"lottie").load(self.
documentdocument, json.dumps(self.
animationanimation.to_dict()).encode(
"utf8"))
46 self.
documentdocument.current_time = frame
54 return glaxnimate.utils.Color(*(color * 255).components)
58 return NVector(color.red / 255., color.green / 255., color.blue / 255., color.alpha / 255.)
62 return Point(point.x, point.y)
def __exit__(self, *a, **k)
def serialize(self, frame, fp)
def __init__(self, animation, serializer_slug, dpi)
def serialize(animation, serializer_slug, time=0)
def convert(animation, exporter_slug)
def color_from_glaxnimate(color)
def point_from_glaxnimate(point)
def color_to_glaxnimate(NVector color)