| <!doctype html> |
| <html> |
| <head> |
| <title>Test of -webkit-animation-direction on composited elements (opacity)</title> |
| <style> |
| body { |
| margin: 0; |
| } |
| |
| .box { |
| position: relative; |
| left: 20px; |
| top: 10px; |
| height: 50px; |
| width: 250px; |
| margin-bottom: 10px; |
| -webkit-animation-duration: 1s; |
| -webkit-animation-timing-function: linear; |
| -webkit-animation-iteration-count: 8; |
| } |
| |
| .fade1 { |
| -webkit-animation-name: fade1; |
| background-color: blue; |
| color: white; |
| } |
| |
| .fade2 { |
| -webkit-animation-name: fade2; |
| background-color: orange; |
| } |
| |
| .normal { |
| -webkit-animation-direction: normal; |
| } |
| |
| .alternate { |
| -webkit-animation-direction: alternate; |
| } |
| |
| .reverse { |
| -webkit-animation-direction: reverse; |
| } |
| |
| .alternate-reverse { |
| -webkit-animation-direction: alternate-reverse; |
| } |
| |
| @-webkit-keyframes fade1 { |
| from { opacity: 0; } |
| to { opacity: 1.0; } |
| } |
| |
| @-webkit-keyframes fade2 { |
| 0% { opacity: 0.0; } |
| 40% { opacity: 0.8; } |
| 60% { opacity: 0.4; } |
| 100% { opacity: 1.0; } |
| } |
| </style> |
| <script src="resources/animation-test-helpers.js"></script> |
| <script> |
| const expectedValues = [ |
| // [animation-name, time, element-id, property, expected-value, tolerance] |
| ["fade1", 0.2, "box1", "opacity", 0.2, 0.15], |
| ["fade1", 0.2, "box2", "opacity", 0.2, 0.15], |
| ["fade1", 0.2, "box3", "opacity", 0.8, 0.15], |
| ["fade1", 0.2, "box4", "opacity", 0.8, 0.15], |
| ["fade1", 1.2, "box1", "opacity", 0.2, 0.15], |
| ["fade1", 1.2, "box2", "opacity", 0.8, 0.15], |
| ["fade1", 1.2, "box3", "opacity", 0.8, 0.15], |
| ["fade1", 1.2, "box4", "opacity", 0.2, 0.15], |
| ["fade2", 0.2, "box5", "opacity", 0.4, 0.15], |
| ["fade2", 0.2, "box6", "opacity", 0.4, 0.15], |
| ["fade2", 0.2, "box7", "opacity", 0.7, 0.15], |
| ["fade2", 0.2, "box8", "opacity", 0.7, 0.15], |
| ["fade2", 1.2, "box5", "opacity", 0.4, 0.15], |
| ["fade2", 1.2, "box6", "opacity", 0.7, 0.15], |
| ["fade2", 1.2, "box7", "opacity", 0.7, 0.15], |
| ["fade2", 1.2, "box8", "opacity", 0.4, 0.15], |
| ]; |
| |
| runAnimationTest(expectedValues); |
| |
| </script> |
| </head> |
| <body> |
| <div id="box1" class="box fade1 normal">2 keyframes: normal</div> |
| <div id="box2" class="box fade1 alternate">2 keyframes: alternate</div> |
| <div id="box3" class="box fade1 reverse">2 keyframes: reverse</div> |
| <div id="box4" class="box fade1 alternate-reverse">2 keyframes: alternate-reverse</div> |
| <div id="box5" class="box fade2 normal">4 keyframes: normal</div> |
| <div id="box6" class="box fade2 alternate">4 keyframes: alternate</div> |
| <div id="box7" class="box fade2 reverse">4 keyframes: reverse</div> |
| <div id="box8" class="box fade2 alternate-reverse">4 keyframes: alternate-reverse</div> |
| <div id="result"></div> |
| </div> |
| </body> |
| </html> |