add option to enable/disable animation for day and room name

This commit is contained in:
Franzi 2023-09-30 14:14:47 +02:00
parent aba29ffa52
commit 0e909333d6
2 changed files with 34 additions and 2 deletions

20
tile.js
View file

@ -70,6 +70,13 @@ var config = {
<option value="right">Align right</option> <option value="right">Align right</option>
</select> </select>
</div> </div>
<div class='col-xs-3'>
<input
type="checkbox"
v-model="room_animate"
class='form-check-input'/>
Fade in and out
</div>
</div> </div>
</template> </template>
<template v-if='mode == "day"'> <template v-if='mode == "day"'>
@ -91,6 +98,13 @@ var config = {
placeholder="Template: 'Day %s'" placeholder="Template: 'Day %s'"
class='form-control'/> class='form-control'/>
</div> </div>
<div class='col-xs-3'>
<input
type="checkbox"
v-model="day_animate"
class='form-check-input'/>
Fade in and out
</div>
</div> </div>
</template> </template>
</div> </div>
@ -99,12 +113,18 @@ var config = {
mode: ChildTile.config_value('mode', 'all_talks'), mode: ChildTile.config_value('mode', 'all_talks'),
color: ChildTile.config_value('color', '#ffffff'), color: ChildTile.config_value('color', '#ffffff'),
font_size: ChildTile.config_value('font_size', 70, parseInt), font_size: ChildTile.config_value('font_size', 70, parseInt),
all_speakers: ChildTile.config_value('all_speakers', true), all_speakers: ChildTile.config_value('all_speakers', true),
next_abstract: ChildTile.config_value('next_abstract', false), next_abstract: ChildTile.config_value('next_abstract', false),
next_track_text: ChildTile.config_value('next_track_text', false), next_track_text: ChildTile.config_value('next_track_text', false),
room_align: ChildTile.config_value('room_align', 'left'), room_align: ChildTile.config_value('room_align', 'left'),
room_animate: ChildTile.config_value('room_animate', true),
day_align: ChildTile.config_value('day_align', 'left'), day_align: ChildTile.config_value('day_align', 'left'),
day_template: ChildTile.config_value('day_template', 'Day %d'), day_template: ChildTile.config_value('day_template', 'Day %d'),
day_animate: ChildTile.config_value('day_animate', false),
} }
} }

View file

@ -337,7 +337,9 @@ end
local function view_room(starts, ends, config, x1, y1, x2, y2) local function view_room(starts, ends, config, x1, y1, x2, y2)
local font_size = config.font_size or 70 local font_size = config.font_size or 70
local align = config.room_align or "left" local align = config.room_align or "left"
local animate = config.room_animate
local default_color = {helper.parse_rgb(config.color or "#ffffff")} local default_color = {helper.parse_rgb(config.color or "#ffffff")}
local r,g,b = helper.parse_rgb(config.color or "#ffffff")
local a = anims.Area(x2 - x1, y2 - y1) local a = anims.Area(x2 - x1, y2 - y1)
@ -358,7 +360,11 @@ local function view_room(starts, ends, config, x1, y1, x2, y2)
text(x, 0, current_room, font_size, rgba(default_color,1)) text(x, 0, current_room, font_size, rgba(default_color,1))
for now in api.frame_between(starts, ends) do for now in api.frame_between(starts, ends) do
a.draw(now, x1, y1, x2, y2) if animate then
a.draw(now, x1, y1, x2, y2)
else
font:write(x1+x, y1, line, font_size, r,g,b,1)
end
end end
end end
@ -366,7 +372,9 @@ local function view_day(starts, ends, config, x1, y1, x2, y2)
local font_size = config.font_size or 70 local font_size = config.font_size or 70
local align = config.day_align or "left" local align = config.day_align or "left"
local template = config.day_template or "Day %d" local template = config.day_template or "Day %d"
local animate = config.day_animate
local default_color = {helper.parse_rgb(config.color or "#ffffff")} local default_color = {helper.parse_rgb(config.color or "#ffffff")}
local r,g,b = helper.parse_rgb(config.color or "#ffffff")
local a = anims.Area(x2 - x1, y2 - y1) local a = anims.Area(x2 - x1, y2 - y1)
@ -388,7 +396,11 @@ local function view_day(starts, ends, config, x1, y1, x2, y2)
text(x, 0, line, font_size, rgba(default_color,1)) text(x, 0, line, font_size, rgba(default_color,1))
for now in api.frame_between(starts, ends) do for now in api.frame_between(starts, ends) do
a.draw(now, x1, y1, x2, y2) if animate then
a.draw(now, x1, y1, x2, y2)
else
font:write(x1+x, y1, line, font_size, r,g,b,1)
end
end end
end end