RESOLVED FIXED 91322
When using TextureMapper, WebKit does not retain final value of opacity in animations, unless it is specified on the last key frame
https://bugs.webkit.org/show_bug.cgi?id=91322
Summary When using TextureMapper, WebKit does not retain final value of opacity in an...
Behrang Saeedzadeh
Reported 2012-07-14 04:42:05 PDT
I am not sure if this is a bug in the spec, or WebKit, or a bug at all, but IMHO this behavior does not make sense: Please compare this (http://jsfiddle.net/nX9sG/1/) and this (http://jsfiddle.net/RUk35/) to see what I mean. In the first one, I have modified animate.css so that the opacity is set to 1 on the final key frame, even though it already gets set to this value in an earlier key frame. This makes the element to which this animation is applied retain the final opacity. Here's the JS Fiddle code: <div id="foo"> </div>​ #foo { opacity: 0; position: absolute; width: 100px; height: 200px; top: 10px; left: 10px; border: 1px solid black; } /* Animate.css - http://daneden.me/animate LICENSED UNDER THE MIT LICENSE (MIT) Copyright (c) 2012 Dan Eden Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ .animated { -webkit-animation-fill-mode: both; -moz-animation-fill-mode: both; -ms-animation-fill-mode: both; -o-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration: 1s; -moz-animation-duration: 1s; -ms-animation-duration: 1s; -o-animation-duration: 1s; animation-duration: 1s; } .animated.hinge { -webkit-animation-duration: 2s; -moz-animation-duration: 2s; -ms-animation-duration: 2s; -o-animation-duration: 2s; animation-duration: 2s; } @-webkit-keyframes bounceIn { 0% { opacity: 0; -webkit-transform: scale(.3); } 50% { opacity: 1; -webkit-transform: scale(1.05); } 70% { -webkit-transform: scale(.9); } 100% { -webkit-transform: scale(1); opacity: 1; } } @-moz-keyframes bounceIn { 0% { opacity: 0; -moz-transform: scale(.3); } 50% { opacity: 1; -moz-transform: scale(1.05); } 70% { -moz-transform: scale(.9); } 100% { -moz-transform: scale(1); opacity: 1; } } @-o-keyframes bounceIn { 0% { opacity: 0; -o-transform: scale(.3); } 50% { opacity: 1; -o-transform: scale(1.05); } 70% { -o-transform: scale(.9); } 100% { -o-transform: scale(1); opacity: 1; } } @keyframes bounceIn { 0% { opacity: 0; transform: scale(.3); } 50% { opacity: 1; transform: scale(1.05); } 70% { transform: scale(.9); } 100% { transform: scale(1); opacity: 1; } } .bounceIn { -webkit-animation-name: bounceIn; -moz-animation-name: bounceIn; -o-animation-name: bounceIn; animation-name: bounceIn; } $(document).ready(function() { $("#foo").addClass("animated bounceIn"); });​ I have reported this bug here too: https://github.com/daneden/animate.css/issues/37
Attachments
Patch (6.45 KB, patch)
2012-07-23 16:56 PDT, Hanyee Kim
no flags
Patch (6.47 KB, patch)
2012-07-23 17:34 PDT, Hanyee Kim
no flags
Hanyee Kim
Comment 1 2012-07-23 16:56:32 PDT
Hanyee Kim
Comment 2 2012-07-23 17:13:14 PDT
This is a bug in WebKit. According to your case, the opacity should be set to 1 on the final key frame. I uploaded patch. Thanks Behrang Saeedzadeh for reporting this bug.(In reply to comment #0) > I am not sure if this is a bug in the spec, or WebKit, or a bug at all, but IMHO this behavior does not make sense:> > Please compare this (http://jsfiddle.net/nX9sG/1/) and this (http://jsfiddle.net/RUk35/) to see what I mean. > > In the first one, I have modified animate.css so that the opacity is set to 1 on the final key frame, even though it already gets set to this value in an earlier key frame. This makes the element to which this animation is applied retain the final opacity. > > Here's the JS Fiddle code: > > <div id="foo"> > </div>​ > > > #foo { > opacity: 0; > position: absolute; > width: 100px; > height: 200px; > top: 10px; > left: 10px; > border: 1px solid black; > } > > /* > Animate.css - http://daneden.me/animate > LICENSED UNDER THE MIT LICENSE (MIT) > > Copyright (c) 2012 Dan Eden > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > */ > > .animated { > -webkit-animation-fill-mode: both; > -moz-animation-fill-mode: both; > -ms-animation-fill-mode: both; > -o-animation-fill-mode: both; > animation-fill-mode: both; > -webkit-animation-duration: 1s; > -moz-animation-duration: 1s; > -ms-animation-duration: 1s; > -o-animation-duration: 1s; > animation-duration: 1s; > } > > .animated.hinge { > -webkit-animation-duration: 2s; > -moz-animation-duration: 2s; > -ms-animation-duration: 2s; > -o-animation-duration: 2s; > animation-duration: 2s; > } > > @-webkit-keyframes bounceIn { > 0% { > opacity: 0; > -webkit-transform: scale(.3); > } > > 50% { > opacity: 1; > -webkit-transform: scale(1.05); > } > > 70% { > -webkit-transform: scale(.9); > } > > 100% { > -webkit-transform: scale(1); > opacity: 1; > } > } > > @-moz-keyframes bounceIn { > 0% { > opacity: 0; > -moz-transform: scale(.3); > } > > 50% { > opacity: 1; > -moz-transform: scale(1.05); > } > > 70% { > -moz-transform: scale(.9); > } > > 100% { > -moz-transform: scale(1); > opacity: 1; > } > } > > @-o-keyframes bounceIn { > 0% { > opacity: 0; > -o-transform: scale(.3); > } > > 50% { > opacity: 1; > -o-transform: scale(1.05); > } > > 70% { > -o-transform: scale(.9); > } > > 100% { > -o-transform: scale(1); > opacity: 1; > } > } > > @keyframes bounceIn { > 0% { > opacity: 0; > transform: scale(.3); > } > > 50% { > opacity: 1; > transform: scale(1.05); > } > > 70% { > transform: scale(.9); > } > > 100% { > transform: scale(1); > opacity: 1; > } > } > > .bounceIn { > -webkit-animation-name: bounceIn; > -moz-animation-name: bounceIn; > -o-animation-name: bounceIn; > animation-name: bounceIn; > } > > > $(document).ready(function() { > $("#foo").addClass("animated bounceIn"); > });​ > > I have reported this bug here too: https://github.com/daneden/animate.css/issues/37
Noam Rosenthal
Comment 3 2012-07-23 17:23:13 PDT
Comment on attachment 153901 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153901&action=review Thanks for catching this! Some nitpicks but otherwise good. > Source/WebCore/ChangeLog:4 > + WebKit does not retain final value of opacity in animations, unless it is specified on the last key frame > + https://bugs.webkit.org/show_bug.cgi?id=91322 This bug currently affects TextureMapper only (since other ports of GraphicsLayer don't use this file). That should be portrayed in the bug description and Changelog. > Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp:54 > + return 1.0; Use 1 instead of 1.0. > Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp:57 > + return shouldReverseAnimationValue(direction, iterationCount) ? 1.0 : 0; ditto
Hanyee Kim
Comment 4 2012-07-23 17:34:54 PDT
Hanyee Kim
Comment 5 2012-07-23 17:36:29 PDT
Thanks for reviewing. I updated new patch for review. I have one question. Why i should use 1 instead of 1.0 to returning double value? (In reply to comment #3)
Noam Rosenthal
Comment 6 2012-07-23 17:39:33 PDT
> Why i should use 1 instead of 1.0 to returning double value? http://www.webkit.org/coding/coding-style.html Search for "floating point literals" :)
Hanyee Kim
Comment 7 2012-07-23 17:47:06 PDT
Thanks! I read coding style guideline again. :) (In reply to comment #6)
WebKit Review Bot
Comment 8 2012-07-23 18:15:18 PDT
Comment on attachment 153916 [details] Patch Clearing flags on attachment: 153916 Committed r123414: <http://trac.webkit.org/changeset/123414>
WebKit Review Bot
Comment 9 2012-07-23 18:15:22 PDT
All reviewed patches have been landed. Closing bug.
Behrang Saeedzadeh
Comment 10 2012-07-30 22:10:12 PDT
Hi all, Thanks for the very quick fix! All the best, Behrang (In reply to comment #2) > This is a bug in WebKit. > > According to your case, the opacity should be set to 1 on the final key frame. > > I uploaded patch. > > Thanks Behrang Saeedzadeh for reporting this bug.(In reply to comment #0) > > I am not sure if this is a bug in the spec, or WebKit, or a bug at all, but IMHO this behavior does not make sense:> > > Please compare this (http://jsfiddle.net/nX9sG/1/) and this (http://jsfiddle.net/RUk35/) to see what I mean. > > > > In the first one, I have modified animate.css so that the opacity is set to 1 on the final key frame, even though it already gets set to this value in an earlier key frame. This makes the element to which this animation is applied retain the final opacity. > > > > Here's the JS Fiddle code: > > > > <div id="foo"> > > </div>​ > > > > > > #foo { > > opacity: 0; > > position: absolute; > > width: 100px; > > height: 200px; > > top: 10px; > > left: 10px; > > border: 1px solid black; > > } > > > > /* > > Animate.css - http://daneden.me/animate > > LICENSED UNDER THE MIT LICENSE (MIT) > > > > Copyright (c) 2012 Dan Eden > > > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > > > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. > > > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > > */ > > > > .animated { > > -webkit-animation-fill-mode: both; > > -moz-animation-fill-mode: both; > > -ms-animation-fill-mode: both; > > -o-animation-fill-mode: both; > > animation-fill-mode: both; > > -webkit-animation-duration: 1s; > > -moz-animation-duration: 1s; > > -ms-animation-duration: 1s; > > -o-animation-duration: 1s; > > animation-duration: 1s; > > } > > > > .animated.hinge { > > -webkit-animation-duration: 2s; > > -moz-animation-duration: 2s; > > -ms-animation-duration: 2s; > > -o-animation-duration: 2s; > > animation-duration: 2s; > > } > > > > @-webkit-keyframes bounceIn { > > 0% { > > opacity: 0; > > -webkit-transform: scale(.3); > > } > > > > 50% { > > opacity: 1; > > -webkit-transform: scale(1.05); > > } > > > > 70% { > > -webkit-transform: scale(.9); > > } > > > > 100% { > > -webkit-transform: scale(1); > > opacity: 1; > > } > > } > > > > @-moz-keyframes bounceIn { > > 0% { > > opacity: 0; > > -moz-transform: scale(.3); > > } > > > > 50% { > > opacity: 1; > > -moz-transform: scale(1.05); > > } > > > > 70% { > > -moz-transform: scale(.9); > > } > > > > 100% { > > -moz-transform: scale(1); > > opacity: 1; > > } > > } > > > > @-o-keyframes bounceIn { > > 0% { > > opacity: 0; > > -o-transform: scale(.3); > > } > > > > 50% { > > opacity: 1; > > -o-transform: scale(1.05); > > } > > > > 70% { > > -o-transform: scale(.9); > > } > > > > 100% { > > -o-transform: scale(1); > > opacity: 1; > > } > > } > > > > @keyframes bounceIn { > > 0% { > > opacity: 0; > > transform: scale(.3); > > } > > > > 50% { > > opacity: 1; > > transform: scale(1.05); > > } > > > > 70% { > > transform: scale(.9); > > } > > > > 100% { > > transform: scale(1); > > opacity: 1; > > } > > } > > > > .bounceIn { > > -webkit-animation-name: bounceIn; > > -moz-animation-name: bounceIn; > > -o-animation-name: bounceIn; > > animation-name: bounceIn; > > } > > > > > > $(document).ready(function() { > > $("#foo").addClass("animated bounceIn"); > > });​ > > > > I have reported this bug here too: https://github.com/daneden/animate.css/issues/37
Note You need to log in before you can comment on or make changes to this bug.