Commit 56b70eb0 authored by gijs's avatar gijs

Further on infra

parent d9a48305
......@@ -3,8 +3,8 @@ from svg.path.path import Move, Line, CubicBezier
import svgwrite
from bs4 import BeautifulSoup
height = 800
width = height/(1920/1080)
# height = 800
# width = height/(1920/1080)
def get_group_by_label (svg, label):
for group in svg.find_all('g'):
......@@ -20,12 +20,13 @@ with open('timeline.inkscape.svg', 'r') as handle:
# use bs 4 to find paths
soup = BeautifulSoup(handle.read(), 'lxml')
svg = soup.find('svg')
# path = soup.find('path')
# segments = parse_path(path.get('d'))
svg['width'] = width
svg['height'] = height
svg['viewbox'] = '0 0 {} {}'.format(width, height)
# svg['width'] = width
# svg['height'] = height
# svg['viewbox'] = '0 0 {} {}'.format(width, height)
# layers = [
# {
......@@ -54,10 +55,12 @@ with open('timeline.inkscape.svg', 'r') as handle:
animation = get_group_by_label(soup, 'animation')
translation = animation.get('transform')
keypoints_layer.extract()
for i, center in enumerate(keypoints):
animation['transform'] = 'translate({}, {})'.format(-1 * (center.real - (width / 2)), 150)
animation['transform'] = 'translate({}, {})'.format(-1 * (center.real - (float(svg['width']) / 2)), 271.21332)
# print(path, 'translate({}, {})'.format(center.real - (width / 2), 0))
with open('frames/{}.svg'.format(i), 'w') as o:
o.write(svg.prettify(formatter=None)
......
......@@ -11,9 +11,9 @@
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="2269.712402"
height="228.786682"
viewBox="0 0 2269.712402 228.786682"
width="400"
height="500"
viewBox="0 0 400 500"
id="svg6"
sodipodi:docname="timeline.inkscape.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
......@@ -80,24 +80,27 @@
inkscape:window-height="717"
id="namedview8"
showgrid="false"
inkscape:zoom="0.60448187"
inkscape:cx="862.50474"
inkscape:cy="140.13576"
inkscape:zoom="0.42743323"
inkscape:cx="692.0184"
inkscape:cy="273.45942"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer2"
inkscape:current-layer="layer4"
showguides="false" />
<!-- Original BoundingBox: -1.000000 -1.015442 2268.712402 227.771240 -->
<path
id="path4" />
id="path4"
d=""
inkscape:connector-curvature="0" />
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="animation"
style="display:inline">
style="display:inline"
transform="translate(0,271.21332)">
<g
transform="translate(-1.9238281e-6,-2.1716309e-6)"
transform="translate(-1.9238281e-6,-160)"
id="g1039">
<g
id="g1308">
......@@ -135,10 +138,10 @@
inkscape:label="typography"
style="display:inline">
<g
aria-label="11 → 13
JANUARY"
aria-label="11 → 13 JANUARY"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:33.95319748px;line-height:35.77211761px;font-family:Wremena;-inkscape-font-specification:Wremena;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.81892133px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="text851">
id="text851"
transform="translate(0,-158)">
<path
d="m 511.51964,279.35419 h 13.95476 v -3.25951 h -4.82135 v -19.79471 h -9.13341 v 3.22555 h 5.43251 v 16.56916 h -5.43251 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Lack;-inkscape-font-specification:Lack;text-align:start;text-anchor:start;stroke-width:1.81892133px"
......@@ -201,10 +204,10 @@ JANUARY"
inkscape:connector-curvature="0" />
</g>
<g
aria-label="11 → 13
JANUARY"
aria-label="11 → 13 JANUARY"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32.75760651px;line-height:34.51248169px;font-family:Wremena;-inkscape-font-specification:Wremena;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.75487196px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="text851-3">
id="text851-3"
transform="translate(0,-160)">
<path
d="m 1032.9996,274.12906 h 13.4634 v -3.14473 h -4.6516 v -19.09769 h -8.8118 v 3.11198 h 5.2412 v 15.98571 h -5.2412 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Lack;-inkscape-font-specification:Lack;text-align:start;text-anchor:start;stroke-width:1.75487196px"
......@@ -267,10 +270,10 @@ JANUARY"
inkscape:connector-curvature="0" />
</g>
<g
aria-label="11 → 13
JANUARY"
aria-label="11 → 13 JANUARY"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:36.53907013px;line-height:38.496521px;font-family:Wremena;-inkscape-font-specification:Wremena;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.95745027px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="text901">
id="text901"
transform="translate(0,-174)">
<path
d="m 1643.5494,284.9682 h 15.0176 v -3.50775 h -5.1886 v -21.30228 h -9.829 v 3.47121 h 5.8463 v 17.83107 h -5.8463 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Lack;-inkscape-font-specification:Lack;text-align:start;text-anchor:start;stroke-width:1.95745027px"
......@@ -338,71 +341,41 @@ JANUARY"
inkscape:groupmode="layer"
id="layer2"
inkscape:label="keypoints"
style="display:inline">
<rect
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="rect955"
width="388.7627"
height="554.1936"
x="39.703423"
y="-121.9269" />
<rect
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="rect955-9"
width="388.7627"
height="554.1936"
x="397.86139"
y="-122.75404" />
<rect
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="rect955-9-1"
width="388.7627"
height="554.1936"
x="905.73431"
y="-128.95145" />
<rect
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="rect955-9-1-2"
width="388.7627"
height="554.1936"
x="1521.1373"
y="-131.02557" />
<rect
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="rect955-9-1-2-7"
width="388.7627"
height="554.1936"
x="1967.8009"
y="-122.75402" />
style="display:inline"
transform="translate(0,271.21332)">
<circle
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="path1145"
cx="217.57784"
cy="125.84663"
cy="-34.153374"
r="7.01864" />
<circle
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="path1145-7"
cx="579.57782"
cy="125.84662"
cy="-34.153381"
r="7.01864" />
<circle
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="path1145-7-5"
cx="1085.5779"
cy="125.84662"
cy="-34.153381"
r="7.01864" />
<circle
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="path1145-7-5-9"
cx="1725.5779"
cy="125.84662"
cy="-34.153381"
r="7.01864" />
<circle
style="display:inline;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#28220b;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:markers stroke fill"
id="path1145-2"
cx="853.40118"
cy="122.34277"
cy="-37.657227"
r="7.01864" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="Passepartour" />
</svg>
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