animation.rml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <rml>
  2. <head>
  3. <link type="text/template" href="../../../assets/window.rml"/>
  4. <title>Animation Sample</title>
  5. <style>
  6. body.window
  7. {
  8. max-width: 2000px;
  9. max-height: 2000px;
  10. width: 1600px;
  11. height: 750px;
  12. perspective: 3000px;
  13. /*opacity: 0;*/
  14. }
  15. button {
  16. margin-top: 50px;
  17. }
  18. div#title_bar div#icon
  19. {
  20. display: none;
  21. }
  22. spacer
  23. {
  24. display: inline-block;
  25. width: 25px;
  26. }
  27. #start_game
  28. {
  29. opacity: 0.8;
  30. transform: rotate(370deg) translateX(100px) scale(1.2);
  31. transform-origin: 30% 80% 0;
  32. }
  33. #options {
  34. transform: scale(1.0);
  35. }
  36. #options:hover {
  37. animation: 1s spinner infinite;
  38. }
  39. @keyframes spinner {
  40. from { transform: scale(1.0) rotate(0deg); }
  41. 25% { transform: scale(1.2) rotate(90deg); }
  42. 50% { transform: scale(1.3) rotate(180deg); }
  43. 75% { transform: scale(1.2) rotate(270deg); }
  44. to { transform: scale(1.0) rotate(360deg); }
  45. }
  46. #high_scores {
  47. margin-left: -100px;
  48. }
  49. #exit {
  50. transform: rotate(45deg);
  51. transform-origin: 50% 50% 0;
  52. }
  53. div.container
  54. {
  55. margin-top: 15px;
  56. width: 100%;
  57. height: 200px;
  58. background-color: #ae8484aa;
  59. }
  60. div.plain
  61. {
  62. font-size: 1.2em;
  63. padding: 10px;
  64. margin: auto;
  65. width: 130px;
  66. height: 70px;
  67. background-color: #c66;
  68. }
  69. div.plain:hover { background-color: #ddb700; }
  70. /* -- TRANSFORM TESTS */
  71. #generic {
  72. /* Note the translateX vs translateY in animation target, and rotateZ vs rotate3d, scaleX vs scaleY.
  73. In order to match, they are converted to their generic forms, translate3d, rotate3d, and scale3d.
  74. For rotate3d to match another rotation, their rotation axes must align. */
  75. transform: translateX(100px) rotateZ(70deg) scaleX(1.3);
  76. }
  77. #combine {
  78. transform: rotate(45deg);
  79. }
  80. #decomposition {
  81. /* To interpolate the rotate3d transforms, we need to decompose the matrix,
  82. see the element info in the debugger for the resulting matrix. */
  83. transform: translateX(100px) rotate3d(1.0, 0, 1.0, 0deg);
  84. }
  85. /* -- MIXED UNITS TESTS */
  86. #abs_rel {
  87. margin: 0;
  88. margin-left: 50px;
  89. }
  90. #abs_rel_transform {
  91. margin: 0;
  92. transform: translateX(100%);
  93. }
  94. #animation_event {
  95. position: relative;
  96. margin: 0;
  97. top: 50px; left: 50px;
  98. }
  99. /* -- TRANSITION TESTS */
  100. #transition_test {
  101. /*transition: padding-left 1.6s elastic-in 1.0, background-color 1.2s quadratic-in 1.0, transform 1.3s exponential-in 1.0;*/
  102. transition: padding-left background-color transform 1.6s elastic-out 0.0;
  103. transform: scale(1.0);
  104. }
  105. #transition_test:hover {
  106. /*transition: padding-left background-color transform 0.8s quadratic-out 1.0;*/
  107. padding-left: 60px;
  108. transform: scale(1.5);
  109. }
  110. #transition_class {
  111. margin-left: 50px;
  112. transition: margin-left background-color 0.5s cubic-out;
  113. }
  114. #transition_class.move_me {
  115. margin-left: -50px;
  116. font-size: 22px;
  117. }
  118. /* -- KEYFRAMES TESTS */
  119. @keyframes hello-world
  120. {
  121. 25% {
  122. transform: rotate(180deg);
  123. }
  124. 40% {
  125. transform: rotate(180deg) translateX(200px);
  126. }
  127. 60% {
  128. transform: rotate(180deg) translateX(-200px);
  129. }
  130. 75% {
  131. transform: rotate(180deg);
  132. }
  133. to {
  134. transform: rotate(360deg);
  135. }
  136. }
  137. #keyframes_test
  138. {
  139. transform: rotate(0);
  140. animation: 5s bounce-out infinite hello-world;
  141. transition: background-color 0.5s exponential-in-out;
  142. }
  143. @keyframes some-missing-keys
  144. {
  145. 0%, 30% {
  146. background-color: #d99;
  147. }
  148. 50% {
  149. background-color: #9d9;
  150. }
  151. to {
  152. background-color: #f9f;
  153. width: 100%;
  154. }
  155. }
  156. #keyframes_missing_keys
  157. {
  158. position: relative;
  159. margin: 0; padding: 0;
  160. top: 0; left: 0;
  161. width: 25px; height: 25px;
  162. animation: 2s cubic-in-out infinite alternate some-missing-keys;
  163. }
  164. #keyevent_response
  165. {
  166. position: relative;
  167. margin: 0; padding: 0;
  168. top: 110px; left: 0;
  169. width: 100px; height: 55px;
  170. }
  171. #performance
  172. {
  173. position: absolute;
  174. bottom: 0;
  175. height: 30%;
  176. width: 20%;
  177. left: -100px;
  178. transform: scale(0.5) rotate(-90deg);
  179. }
  180. </style>
  181. </head>
  182. <body template="window">
  183. <div style="width: 20%; height: 80%; position: absolute;">
  184. <div style="font-size: 0.85em; text-align: left;" id="fps"></div>
  185. <button id="start_game">Start Game</button><br />
  186. <button id="high_scores" onkeydown="hello">High Scores</button><br />
  187. <button id="options">Options</button><br />
  188. <button id="help">Help</button><br />
  189. <button id="exit" onclick="exit">Exit</button>
  190. </div>
  191. <div id="performance"/>
  192. <div style="width: 20%; height: 80%;position: absolute; left: 28%;" id="transform_tests">
  193. <div style="font-size: 1.5em; text-align: left;">Test transform animations</div>
  194. <div class="container"><div class="plain" id="generic">Generic form conversion.</div></div>
  195. <div class="container"><div class="plain" id="combine">Match different transform primitive sizes</div></div>
  196. <div class="container"><div class="plain" id="decomposition">Force full matrix decomposition</div></div>
  197. </div>
  198. <div style="width: 20%; height: 80%;position: absolute; left: 52%;" id="mixed_units_tests">
  199. <div style="font-size: 1.5em; text-align: left;">Mixed units tests</div>
  200. <div class="container"><div class="plain" id="abs_rel">Pixel vs percentage.</div></div>
  201. <div class="container"><div class="plain" id="abs_rel_transform">Pixel vs percentage transform.</div></div>
  202. <div class="container"><div class="plain" id="animation_event">Animation event</div><div class="plain" id="keyevent_response">Events (press arrow keys)</div></div>
  203. </div>
  204. <div style="width: 20%; height: 80%;position: absolute; left: 75%;" id="transition_tests">
  205. <div style="font-size: 1.5em; text-align: left;">Transition tests</div>
  206. <div class="container"><div class="plain" id="transition_test">Transition test (hover)</div></div>
  207. <div class="container"><div class="plain" id="transition_class" onclick="add_class">Transition class (click)</div></div>
  208. <div class="container"><div class="plain" id="keyframes_test">Keyframes test</div><div class="plain" id="keyframes_missing_keys"/></div>
  209. </div>
  210. </body>
  211. </rml>