loop offset

mako
km0 3 years ago
parent d28556aacb
commit cb8e7b5110

@ -15,7 +15,7 @@
height: 500px; height: 500px;
position: relative; position: relative;
top: 5000px; top: 5000px;
left: 0px; left: 5000px;
} }
.svg-container { .svg-container {

@ -8,12 +8,13 @@
<link rel="stylesheet" href="${url_for('static', filename='css/display_mako.css')}"> <link rel="stylesheet" href="${url_for('static', filename='css/display_mako.css')}">
</%block> </%block>
<% from random import random %> <% from random import random %>
<% offset = 1 / len(streams)%>
% for stream in streams: % for stream in streams:
<div class="stream"> <div class="stream">
<% transform = '' %> <% transform = '' %>
% for branch in stream: % for branch in stream:
<% transform = transform + ' rotate(' + str((random() * 2 - 1) * 0.02) + 'turn) translateX(100%)'%> <% transform = transform + ' rotate(' + str((random() * 2 - 1) * 0.02 + (offset * loop.index)) + 'turn) translateX(100%)'%>
<div class="svg-container" style="transform: ${transform}">${branch['content']}</div> <div class="svg-container" style="transform: ${transform}">${branch['content']}</div>
% endfor % endfor
</div> </div>

Loading…
Cancel
Save