started to work on transitions

This commit is contained in:
Andreas Preikschat 2013-03-04 11:52:38 +01:00
parent c2794b6355
commit 557c90129a
2 changed files with 15 additions and 19 deletions

View File

@ -152,10 +152,6 @@ sup {
text_fade('lyricsmain', newtext); text_fade('lyricsmain', newtext);
text_fade('lyricsoutline', newtext); text_fade('lyricsoutline', newtext);
text_fade('lyricsshadow', newtext.replace(match, '')); text_fade('lyricsshadow', newtext.replace(match, ''));
if(text_opacity() == 1) return;
timer = setTimeout(function(){
show_text(newtext);
}, 100);
} }
function text_fade(id, newtext){ function text_fade(id, newtext){
@ -174,25 +170,18 @@ sup {
text.innerHTML = newtext; text.innerHTML = newtext;
return; return;
} }
if(newtext == text.innerHTML){ text.style.opacity = '0';
text.style.opacity = parseFloat(text.style.opacity) + 0.3; timer = window.setTimeout(function(){bla(text, newtext)}, 1000);
if(text.style.opacity > 0.7)
text.style.opacity = 1;
} else {
text.style.opacity = parseFloat(text.style.opacity) - 0.3;
if(text.style.opacity <= 0.1){
text.innerHTML = newtext;
}
}
} }
function text_opacity(){ function bla(text, newtext) {
var text = document.getElementById('lyricsmain'); text.innerHTML = newtext;
return getComputedStyle(text, '').opacity; text.style.opacity = '1';
} }
function show_text_complete(){ function show_text_complete(){
return (text_opacity() == 1); var text = document.getElementById('lyricsmain');
return getComputedStyle(text, '').opacity == 1;
} }
</script> </script>
</head> </head>
@ -331,20 +320,25 @@ def build_lyrics_css(item, webkit_ver):
z-index: 5; z-index: 5;
position: absolute; position: absolute;
display: table; display: table;
-webkit-transition: opacity 0.5s linear;
%s %s
} }
.lyricscell { .lyricscell {
display: table-cell; display: table-cell;
word-wrap: break-word; word-wrap: break-word;
-webkit-transition: opacity 0.5s linear;
%s %s
} }
.lyricsmain { .lyricsmain {
-webkit-transition: opacity 0.5s ease-in;
%s %s
} }
.lyricsoutline { .lyricsoutline {
-webkit-transition: opacity 0.5s ease-in;
%s %s
} }
.lyricsshadow { .lyricsshadow {
-webkit-transition: opacity 0.5s ease-in;
%s %s
} }
""" """

View File

@ -76,7 +76,8 @@ class Display(QtGui.QGraphicsView):
# time. We need to investigate more how to use OpenGL properly on Mac OS # time. We need to investigate more how to use OpenGL properly on Mac OS
# X. # X.
if sys.platform != 'darwin': if sys.platform != 'darwin':
self.setViewport(QtOpenGL.QGLWidget()) pass
#self.setViewport(QtOpenGL.QGLWidget())
def setup(self): def setup(self):
""" """
@ -353,6 +354,7 @@ class MainDisplay(Display):
# Wait for the fade to finish before geting the preview. # Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all! # Important otherwise preview will have incorrect text if at all!
if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition: if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
# FIXME: method does not work.
while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false': while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false':
self.application.process_events() self.application.process_events()
# Wait for the webview to update before getting the preview. # Wait for the webview to update before getting the preview.