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('lyricsoutline', newtext);
text_fade('lyricsshadow', newtext.replace(match, ''));
if(text_opacity() == 1) return;
timer = setTimeout(function(){
show_text(newtext);
}, 100);
}
function text_fade(id, newtext){
@ -174,25 +170,18 @@ sup {
text.innerHTML = newtext;
return;
}
if(newtext == text.innerHTML){
text.style.opacity = parseFloat(text.style.opacity) + 0.3;
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;
}
}
text.style.opacity = '0';
timer = window.setTimeout(function(){bla(text, newtext)}, 1000);
}
function text_opacity(){
var text = document.getElementById('lyricsmain');
return getComputedStyle(text, '').opacity;
function bla(text, newtext) {
text.innerHTML = newtext;
text.style.opacity = '1';
}
function show_text_complete(){
return (text_opacity() == 1);
var text = document.getElementById('lyricsmain');
return getComputedStyle(text, '').opacity == 1;
}
</script>
</head>
@ -331,20 +320,25 @@ def build_lyrics_css(item, webkit_ver):
z-index: 5;
position: absolute;
display: table;
-webkit-transition: opacity 0.5s linear;
%s
}
.lyricscell {
display: table-cell;
word-wrap: break-word;
-webkit-transition: opacity 0.5s linear;
%s
}
.lyricsmain {
-webkit-transition: opacity 0.5s ease-in;
%s
}
.lyricsoutline {
-webkit-transition: opacity 0.5s ease-in;
%s
}
.lyricsshadow {
-webkit-transition: opacity 0.5s ease-in;
%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
# X.
if sys.platform != 'darwin':
self.setViewport(QtOpenGL.QGLWidget())
pass
#self.setViewport(QtOpenGL.QGLWidget())
def setup(self):
"""
@ -353,6 +354,7 @@ class MainDisplay(Display):
# Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all!
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':
self.application.process_events()
# Wait for the webview to update before getting the preview.