forked from openlp/openlp
Less interesting, but hopefully slightly faster transitions
This commit is contained in:
parent
305610ed8e
commit
0c62215bb7
@ -58,18 +58,21 @@ body {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
z-index:10;%s
|
z-index:10;
|
||||||
|
%s
|
||||||
}
|
}
|
||||||
#footer {
|
#footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index:5;%s
|
z-index:5;
|
||||||
|
%s
|
||||||
}
|
}
|
||||||
/* lyric css */
|
/* lyric css */
|
||||||
%s
|
%s
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
var timer = null;
|
var timer = null;
|
||||||
var cur_lyrics = '1';
|
var transition = %s;
|
||||||
|
|
||||||
function show_video(state, path, volume, loop){
|
function show_video(state, path, volume, loop){
|
||||||
var vid = document.getElementById('video');
|
var vid = document.getElementById('video');
|
||||||
@ -132,12 +135,9 @@ body {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
document.getElementById('black').style.display = black;
|
document.getElementById('black').style.display = black;
|
||||||
document.getElementById('lyricsmain1').style.visibility = lyrics;
|
document.getElementById('lyricsmain').style.visibility = lyrics;
|
||||||
document.getElementById('lyricsoutline1').style.visibility = lyrics;
|
document.getElementById('lyricsoutline').style.visibility = lyrics;
|
||||||
document.getElementById('lyricsshadow1').style.visibility = lyrics;
|
document.getElementById('lyricsshadow').style.visibility = lyrics;
|
||||||
document.getElementById('lyricsmain2').style.visibility = lyrics;
|
|
||||||
document.getElementById('lyricsoutline2').style.visibility = lyrics;
|
|
||||||
document.getElementById('lyricsshadow2').style.visibility = lyrics;
|
|
||||||
document.getElementById('footer').style.visibility = lyrics;
|
document.getElementById('footer').style.visibility = lyrics;
|
||||||
var vid = document.getElementById('video');
|
var vid = document.getElementById('video');
|
||||||
if(vid.src != ''){
|
if(vid.src != ''){
|
||||||
@ -156,7 +156,7 @@ body {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(position == ''){
|
if(position == ''){
|
||||||
position = window.getComputedStyle(text, '').verticalAlign;
|
position = getComputedStyle(text, '').verticalAlign;
|
||||||
}
|
}
|
||||||
switch(position)
|
switch(position)
|
||||||
{
|
{
|
||||||
@ -181,32 +181,40 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function show_text(newtext){
|
function show_text(newtext){
|
||||||
text_fade_all(cur_lyrics, true);
|
if(timer != null)
|
||||||
cur_lyrics = (cur_lyrics=='1')?'2':'1';
|
clearTimeout(timer);
|
||||||
text_fade_all(cur_lyrics, false, newtext);
|
text_fade('lyricsmain', newtext);
|
||||||
|
text_fade('lyricsoutline', newtext);
|
||||||
|
text_fade('lyricsshadow', newtext);
|
||||||
|
if(text_opacity()==1) return;
|
||||||
|
timer = setTimeout(function(){
|
||||||
|
show_text(newtext);
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
function text_fade_all(item, fadeout, newtext){
|
|
||||||
text_fade('lyricsmain' + item, fadeout, newtext);
|
function text_fade(id, newtext){
|
||||||
text_fade('lyricsoutline' + item, fadeout, newtext);
|
var text = document.getElementById(id);
|
||||||
text_fade('lyricsshadow' + item, fadeout, newtext);
|
if(!transition){
|
||||||
|
text.innerHTML = newtext;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
function text_fade(id, fadeout, newtext){
|
if(text.style.opacity=='') text.style.opacity = 1;
|
||||||
var textitem = document.getElementById(id);
|
if(newtext==text.innerHTML){
|
||||||
if(fadeout) {
|
text.style.opacity = parseFloat(text.style.opacity) + 0.3;
|
||||||
textitem.className += ' fadeout';
|
|
||||||
} else {
|
} else {
|
||||||
textitem.innerHTML = newtext;
|
text.style.opacity -= 0.3;
|
||||||
window.setTimeout(function() {
|
if(text.style.opacity<=0.1)
|
||||||
textitem.className = textitem.className.replace(' fadeout', '');
|
text.innerHTML = newtext;
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function text_opacity(){
|
||||||
|
var text = document.getElementById('lyricsmain');
|
||||||
|
return window.getComputedStyle(text, '').opacity;
|
||||||
|
}
|
||||||
function show_text_complete(){
|
function show_text_complete(){
|
||||||
var item = document.getElementById('lyricsmain' + cur_lyrics);
|
return (text_opacity()==1);
|
||||||
return (window.getComputedStyle(item, '').opacity == 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -221,22 +229,13 @@ co-operating in qwebkit. https://bugs.webkit.org/show_bug.cgi?id=43187
|
|||||||
Therefore one table for text, one for outline and one for shadow.
|
Therefore one table for text, one for outline and one for shadow.
|
||||||
-->
|
-->
|
||||||
<table class="lyricstable lyricscommon">
|
<table class="lyricstable lyricscommon">
|
||||||
<tr><td id="lyricsmain1" class="lyrics"></td></tr>
|
<tr><td id="lyricsmain" class="lyrics"></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<table class="lyricsoutlinetable lyricscommon">
|
<table class="lyricsoutlinetable lyricscommon">
|
||||||
<tr><td id="lyricsoutline1" class="lyricsoutline lyrics"></td></tr>
|
<tr><td id="lyricsoutline" class="lyricsoutline lyrics"></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<table class="lyricsshadowtable lyricscommon">
|
<table class="lyricsshadowtable lyricscommon">
|
||||||
<tr><td id="lyricsshadow1" class="lyricsshadow lyrics"></td></tr>
|
<tr><td id="lyricsshadow" class="lyricsshadow lyrics"></td></tr>
|
||||||
</table>
|
|
||||||
<table class="lyricstable lyricscommon">
|
|
||||||
<tr><td id="lyricsmain2" class="lyrics"></td></tr>
|
|
||||||
</table>
|
|
||||||
<table class="lyricsoutlinetable lyricscommon">
|
|
||||||
<tr><td id="lyricsoutline2" class="lyricsoutline lyrics"></td></tr>
|
|
||||||
</table>
|
|
||||||
<table class="lyricsshadowtable lyricscommon">
|
|
||||||
<tr><td id="lyricsshadow2" class="lyricsshadow lyrics"></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
<div id="alert" style="visibility:hidden;"></div>
|
<div id="alert" style="visibility:hidden;"></div>
|
||||||
<div id="footer" class="footer"></div>
|
<div id="footer" class="footer"></div>
|
||||||
@ -268,11 +267,13 @@ def build_html(item, screen, alert, islive):
|
|||||||
html = HTMLSRC % (width, height,
|
html = HTMLSRC % (width, height,
|
||||||
build_alert(alert, width),
|
build_alert(alert, width),
|
||||||
build_footer(item),
|
build_footer(item),
|
||||||
build_lyrics(item, islive),
|
build_lyrics(item),
|
||||||
|
u'true' if theme and theme.display_slideTransition and islive \
|
||||||
|
else u'false',
|
||||||
image)
|
image)
|
||||||
return html
|
return html
|
||||||
|
|
||||||
def build_lyrics(item, islive):
|
def build_lyrics(item):
|
||||||
"""
|
"""
|
||||||
Build the video display div
|
Build the video display div
|
||||||
|
|
||||||
@ -287,8 +288,6 @@ def build_lyrics(item, islive):
|
|||||||
.lyrics { %s }
|
.lyrics { %s }
|
||||||
.lyricsoutline { %s }
|
.lyricsoutline { %s }
|
||||||
.lyricsshadow { %s }
|
.lyricsshadow { %s }
|
||||||
td { opacity: 1; %s }
|
|
||||||
td.fadeout { opacity: 0; }
|
|
||||||
"""
|
"""
|
||||||
theme = item.themedata
|
theme = item.themedata
|
||||||
lyricscommon = u''
|
lyricscommon = u''
|
||||||
@ -298,7 +297,6 @@ td.fadeout { opacity: 0; }
|
|||||||
lyrics = u''
|
lyrics = u''
|
||||||
outline = u'display: none;'
|
outline = u'display: none;'
|
||||||
shadow = u'display: none;'
|
shadow = u'display: none;'
|
||||||
transition = u''
|
|
||||||
if theme:
|
if theme:
|
||||||
lyricscommon = u'width: %spx; height: %spx; word-wrap: break-word; ' \
|
lyricscommon = u'width: %spx; height: %spx; word-wrap: break-word; ' \
|
||||||
u'font-family: %s; font-size: %spt; color: %s; line-height: %d%%;' \
|
u'font-family: %s; font-size: %spt; color: %s; line-height: %d%%;' \
|
||||||
@ -313,8 +311,6 @@ td.fadeout { opacity: 0; }
|
|||||||
(item.main.x() + float(theme.display_shadow_size),
|
(item.main.x() + float(theme.display_shadow_size),
|
||||||
item.main.y() + float(theme.display_shadow_size))
|
item.main.y() + float(theme.display_shadow_size))
|
||||||
align = u''
|
align = u''
|
||||||
if theme.display_slideTransition and islive:
|
|
||||||
transition = u'-webkit-transition: opacity 1s linear;'
|
|
||||||
if theme.display_horizontalAlign == 2:
|
if theme.display_horizontalAlign == 2:
|
||||||
align = u'text-align:center;'
|
align = u'text-align:center;'
|
||||||
elif theme.display_horizontalAlign == 1:
|
elif theme.display_horizontalAlign == 1:
|
||||||
@ -342,7 +338,7 @@ td.fadeout { opacity: 0; }
|
|||||||
if theme.display_shadow:
|
if theme.display_shadow:
|
||||||
shadow = u'color: %s;' % (theme.display_shadow_color)
|
shadow = u'color: %s;' % (theme.display_shadow_color)
|
||||||
lyrics_html = style % (lyricscommon, lyricstable, outlinetable,
|
lyrics_html = style % (lyricscommon, lyricstable, outlinetable,
|
||||||
shadowtable, lyrics, outline, shadow, transition)
|
shadowtable, lyrics, outline, shadow)
|
||||||
return lyrics_html
|
return lyrics_html
|
||||||
|
|
||||||
def build_footer(item):
|
def build_footer(item):
|
||||||
|
Loading…
Reference in New Issue
Block a user