test linked display
parent
0767c14eea
commit
325fe7e332
@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<%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.5 %>
|
||||
% 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="/draw/${branch['branch']}" target="__blank">
|
||||
${branch['content']}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
% endfor
|
||||
</div>
|
||||
</main>
|
Loading…
Reference in New Issue