Commit 5535f868 authored by gijs's avatar gijs

...

parent 0f8f7fd2
from svg.path import parse_path
from svg.path.path import Move, Line, CubicBezier
import svgwrite
from bs4 import BeautifulSoup
import re
# height = 800
# width = height/(1920/1080)
......@@ -53,14 +53,24 @@ with open('timeline.inkscape.svg', 'r') as handle:
# print(center)
# loopcenters.append(center)
pattern = re.compile(r'/translate\(([\d\.]+),\s?([\d\.]+)\)/')
animation = get_group_by_label(soup, 'animation')
translation = animation.get('transform')
transform = animation.get('transform')
m = pattern.match(transform)
print(transform, m)
if m:
translation = (float(m.group(1)), float(m.group(2)))
else:
translation = (0, 0)
keypoints_layer.extract()
for i, center in enumerate(keypoints):
animation['transform'] = 'translate({}, {})'.format(-1 * (center.real - (float(svg['width']) / 2)), 271.21332)
animation['transform'] = 'translate({}, {})'.format(translation[0] + (-1 * (center.real - (float(svg['width']) / 2))), translation[1])
# print(path, 'translate({}, {})'.format(center.real - (width / 2), 0))
with open('frames/{}.svg'.format(i), 'w') as o:
o.write(svg.prettify(formatter=None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment