You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
935 B
HTML

<%inherit file="base_mako.html" />
<%block name="head">
<link rel="stylesheet" href="${url_for('static', filename='css/display_mako.css')}">
</%block>
<main class="container">
<% from random import random %>
<% from collections import defaultdict %>
<% transform = {'NEW': ''} %>
<% visited = defaultdict(int) %>
<div class="stream">
% for branch in branches:
<% visited[branch['parent']] += 1 %>
% if visited[branch['parent']] > 1:
<% steer = (random() - 0.5) * 0.25 %>
% else:
<% steer = 0 %>
% endif
<% transform[branch['branch']] = f'{transform[branch["parent"]]} rotate({random() * 0.04 + steer}turn) translateX(100%)' %>
<div class="svg-container" style="transform: ${transform[branch['parent']]}">
<a href="${url_for('draw.draw', parent=branch['branch'], _external=True, _scheme='https')}" target="__blank">
${branch['content']}
</a>
</div>
% endfor
</div>
</main>