5 def process(self, animation: objects.Animation, flatten: bool =
True):
7 for layer
in animation.layers:
11 return self.
flattenflatten(data)
22 bez = shape.shape.get_value()
23 if bez
and len(bez.vertices) > 1:
24 data[
"curves"].append(bez)
28 "opacity": (styler.opacity.get_value()
or 100) / 100,
30 styler.gradient.get_stops()[0][0]
32 else styler.color.get_value()
42 for shape
in group.shapes:
48 shape_data[
"curves"] += child_data[
"curves"]
52 self.
process_shapeprocess_shape(shape.to_bezier(), shape_data)
57 shape_data[
"stroke"][
"width"] = shape.width.get_value()
59 if shape_data[
"curves"]
and (shape_data[
"fill"]
or shape_data[
"stroke"]):
60 data.append(shape_data)
67 return list(data[
"color"])[0:3] + [data[
"opacity"]]
75 "stroke_width": item[
"stroke"][
"width"]
if item[
"stroke"]
else 0,
77 base[
"color"] = base[
"fill"]
or base[
"stroke"]
79 for curve
in item[
"curves"]:
81 for i
in range(len(curve.vertices)):
83 points.append(list(v))
84 points.append(list(curve.out_tangents[i] + v))
85 next_i = (i+1) % len(curve.vertices)
86 points.append(list(curve.in_tangents[next_i] + curve.vertices[next_i]))
89 points.push(list(curve.vertices[0]))
97 "closed":
int(curve.closed)
Layer containing ShapeElement objects.
ShapeElement that can contain other shapes.
def process(self, objects.Animation animation, bool flatten=True)
def process_styler(self, styler)
def process_shape_group(self, group, data)
def process_shape(self, objects.Path shape, dict data)
def process_layer(self, layer, data)
def flatten_color(self, data)