|
146 | 146 | """
|
147 | 147 |
|
148 | 148 |
|
| 149 | +# Style definitions for the HTML template |
| 150 | +STYLE_INCLUDE = """ |
| 151 | +<style> |
| 152 | +.animation { |
| 153 | + display: inline-block; |
| 154 | + text-align: center; |
| 155 | +} |
| 156 | +input[type=range].anim-slider { |
| 157 | + width: 374px; |
| 158 | + margin-left: auto; |
| 159 | + margin-right: auto; |
| 160 | +} |
| 161 | +.anim-buttons { |
| 162 | + margin: 8px 0px; |
| 163 | +} |
| 164 | +.anim-buttons button { |
| 165 | + padding: 0; |
| 166 | + width: 36px; |
| 167 | +} |
| 168 | +.anim-state label { |
| 169 | + margin-right: 8px; |
| 170 | +} |
| 171 | +.anim-state input { |
| 172 | + margin: 0; |
| 173 | + vertical-align: middle; |
| 174 | +} |
| 175 | +</style> |
| 176 | +""" |
| 177 | + |
| 178 | + |
149 | 179 | # HTML template for HTMLWriter
|
150 | 180 | DISPLAY_TEMPLATE = """
|
151 |
| -<div class="animation" align="center"> |
152 |
| - <img id="_anim_img{id}"> |
153 |
| - <br> |
154 |
| - <input id="_anim_slider{id}" type="range" style="width:350px" |
| 181 | +<div class="animation"> |
| 182 | + <img id="_anim_img{id}"> |
| 183 | + <div class="anim-controls"> |
| 184 | + <input id="_anim_slider{id}" type="range" class="anim-slider" |
155 | 185 | name="points" min="0" max="1" step="1" value="0"
|
156 | 186 | onchange="anim{id}.set_frame(parseInt(this.value));"></input>
|
157 |
| - <br> |
158 |
| - <button onclick="anim{id}.slower()"><i class="fa fa-minus"></i></button> |
159 |
| - <button onclick="anim{id}.first_frame()"><i class="fa fa-fast-backward"> |
160 |
| - </i></button> |
161 |
| - <button onclick="anim{id}.previous_frame()"> |
162 |
| - <i class="fa fa-step-backward"></i></button> |
163 |
| - <button onclick="anim{id}.reverse_animation()"> |
164 |
| - <i class="fa fa-play fa-flip-horizontal"></i></button> |
165 |
| - <button onclick="anim{id}.pause_animation()"><i class="fa fa-pause"> |
166 |
| - </i></button> |
167 |
| - <button onclick="anim{id}.play_animation()"><i class="fa fa-play"></i> |
168 |
| - </button> |
169 |
| - <button onclick="anim{id}.next_frame()"><i class="fa fa-step-forward"> |
170 |
| - </i></button> |
171 |
| - <button onclick="anim{id}.last_frame()"><i class="fa fa-fast-forward"> |
172 |
| - </i></button> |
173 |
| - <button onclick="anim{id}.faster()"><i class="fa fa-plus"></i></button> |
174 |
| - <form action="#n" name="_anim_loop_select{id}" class="anim_control"> |
175 |
| - <input type="radio" name="state" |
176 |
| - value="once" {once_checked}> Once </input> |
177 |
| - <input type="radio" name="state" |
178 |
| - value="loop" {loop_checked}> Loop </input> |
179 |
| - <input type="radio" name="state" |
180 |
| - value="reflect" {reflect_checked}> Reflect </input> |
181 |
| - </form> |
| 187 | + <div class="anim-buttons"> |
| 188 | + <button onclick="anim{id}.slower()"><i class="fa fa-minus"></i></button> |
| 189 | + <button onclick="anim{id}.first_frame()"><i class="fa fa-fast-backward"> |
| 190 | + </i></button> |
| 191 | + <button onclick="anim{id}.previous_frame()"> |
| 192 | + <i class="fa fa-step-backward"></i></button> |
| 193 | + <button onclick="anim{id}.reverse_animation()"> |
| 194 | + <i class="fa fa-play fa-flip-horizontal"></i></button> |
| 195 | + <button onclick="anim{id}.pause_animation()"><i class="fa fa-pause"> |
| 196 | + </i></button> |
| 197 | + <button onclick="anim{id}.play_animation()"><i class="fa fa-play"></i> |
| 198 | + </button> |
| 199 | + <button onclick="anim{id}.next_frame()"><i class="fa fa-step-forward"> |
| 200 | + </i></button> |
| 201 | + <button onclick="anim{id}.last_frame()"><i class="fa fa-fast-forward"> |
| 202 | + </i></button> |
| 203 | + <button onclick="anim{id}.faster()"><i class="fa fa-plus"></i></button> |
| 204 | + </div> |
| 205 | + <form action="#n" name="_anim_loop_select{id}" class="anim-state"> |
| 206 | + <input type="radio" name="state" value="once" id="_anim_radio1_{id}" |
| 207 | + {once_checked}> |
| 208 | + <label for="_anim_radio1_{id}">Once</label> |
| 209 | + <input type="radio" name="state" value="loop" id="_anim_radio2_{id}" |
| 210 | + {loop_checked}> |
| 211 | + <label for="_anim_radio2_{id}">Loop</label> |
| 212 | + <input type="radio" name="state" value="reflect" id="_anim_radio3_{id}" |
| 213 | + {reflect_checked}> |
| 214 | + <label for="_anim_radio3_{id}">Reflect</label> |
| 215 | + </form> |
| 216 | + </div> |
182 | 217 | </div>
|
183 | 218 |
|
184 | 219 |
|
|
202 | 237 | </script>
|
203 | 238 | """
|
204 | 239 |
|
| 240 | + |
205 | 241 | INCLUDED_FRAMES = """
|
206 | 242 | for (var i=0; i<{Nframes}; i++){{
|
207 | 243 | frames[i] = "{frame_dir}/frame" + ("0000000" + i).slice(-7) +
|
|
0 commit comments