| <!DOCTYPE html> |
| |
| <html> |
| <head> |
| <style> |
| .box { |
| height: 100px; |
| width: 100px; |
| margin: 10px; |
| background-color: blue; |
| display: inline-block; |
| -webkit-transform:translateZ(0); |
| } |
| |
| #grayscale-box { |
| -webkit-animation: grayscale-anim 2s linear |
| } |
| |
| #sepia-box { |
| -webkit-animation: sepia-anim 2s linear |
| } |
| |
| #saturate-box { |
| -webkit-animation: saturate-anim 2s linear |
| } |
| |
| #huerotate-box { |
| -webkit-animation: huerotate-anim 2s linear |
| } |
| |
| #invert-box { |
| -webkit-animation: invert-anim 2s linear |
| } |
| |
| #opacity-box { |
| -webkit-animation: opacity-anim 2s linear |
| } |
| |
| #brightness-box { |
| -webkit-animation: brightness-anim 2s linear |
| } |
| |
| #contrast-box { |
| -webkit-animation: contrast-anim 2s linear |
| } |
| |
| #blur-box { |
| -webkit-animation: blur-anim 2s linear |
| } |
| |
| #dropshadow-box { |
| -webkit-animation: dropshadow-anim 2s linear |
| } |
| |
| @-webkit-keyframes grayscale-anim { |
| from { } |
| 50% { -webkit-filter: grayscale(0.5); } |
| to { -webkit-filter: grayscale(1); } |
| } |
| |
| @-webkit-keyframes sepia-anim { |
| from { } |
| 50% { -webkit-filter: sepia(0.5); } |
| to { -webkit-filter: sepia(1); } |
| } |
| |
| @-webkit-keyframes saturate-anim { |
| from { } |
| 50% { -webkit-filter: saturate(0.5); } |
| to { -webkit-filter: saturate(1); } |
| } |
| |
| @-webkit-keyframes huerotate-anim { |
| from { } |
| 50% { -webkit-filter: hue-rotate(90deg); } |
| to { -webkit-filter: hue-rotate(180deg); } |
| } |
| |
| @-webkit-keyframes invert-anim { |
| from { } |
| 50% { -webkit-filter: invert(0.5); } |
| to { -webkit-filter: invert(1); } |
| } |
| |
| @-webkit-keyframes opacity-anim { |
| from { } |
| 50% { -webkit-filter: opacity(0.5); } |
| to { -webkit-filter: opacity(0); } |
| } |
| |
| @-webkit-keyframes brightness-anim { |
| from { } |
| 50% { -webkit-filter: brightness(0.5); } |
| to { -webkit-filter: brightness(0); } |
| } |
| |
| @-webkit-keyframes contrast-anim { |
| from { } |
| 50% { -webkit-filter: contrast(0.5); } |
| to { -webkit-filter: contrast(0); } |
| } |
| |
| @-webkit-keyframes blur-anim { |
| from { } |
| 50% { -webkit-filter: blur(10px); } |
| to { -webkit-filter: blur(20px); } |
| } |
| |
| @-webkit-keyframes dropshadow-anim { |
| from { } |
| 50% { -webkit-filter: grayscale(10px 15px 5px rgba(128, 128, 128, 0.5); } |
| to { -webkit-filter: drop-shadow(20px 30px 10px black)); } |
| } |
| |
| </style> |
| <script src="../../animations/resources/animation-test-helpers.js"></script> |
| <script type="text/javascript"> |
| const expectedValues = [ |
| // [animation-name, time, element-id, property, expected-value, tolerance] |
| ["grayscale-anim", 0.5, "grayscale-box", "webkitFilter", 'grayscale(0.25)', 0.05], |
| ["sepia-anim", 0.5, "sepia-box", "webkitFilter", 'sepia(0.25)', 0.05], |
| ["saturate-anim", 0.5, "saturate-box", "webkitFilter", 'saturate(0.75)', 0.05], |
| ["huerotate-anim", 0.5, "huerotate-box", "webkitFilter", 'hue-rotate(45deg)', 3], |
| ["invert-anim", 0.5, "invert-box", "webkitFilter", 'invert(0.25)', 0.05], |
| ["opacity-anim", 0.5, "opacity-box", "webkitFilter", 'opacity(0.75)', 0.05], |
| ["brightness-anim", 0.5, "brightness-box", "webkitFilter", 'brightness(0.75)', 0.05], |
| ["contrast-anim", 0.5, "contrast-box", "webkitFilter", 'contrast(0.75)', 0.05], |
| ["blur-anim", 0.5, "blur-box", "webkitFilter", 'blur(5px)', 1], |
| // FIXME when we implement computed filter style for drop-shadow. |
| // ["dropshadow-anim", 1, "dropshadow-box", "webkitFilter", 'drop-shadow(rgba(0, 0, 0, 0.25) 5px 8px 3px )', 2], |
| ]; |
| |
| runAnimationTest(expectedValues); |
| </script> |
| </head> |
| <body> |
| |
| <div class="box" id="grayscale-box"></div> |
| <div class="box" id="sepia-box"></div> |
| <div class="box" id="saturate-box"></div> |
| <div class="box" id="huerotate-box"></div> |
| <div class="box" id="invert-box"></div> |
| <div class="box" id="opacity-box"></div> |
| <div class="box" id="brightness-box"></div> |
| <div class="box" id="contrast-box"></div> |
| <div class="box" id="blur-box"></div> |
| <!-- <div class="box" id="dropshadow-box"></div> --> |
| |
| <div id="result"> |
| </div> |
| </body> |
| </html> |