animation.rml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. @keyframes fadeout {
  50. from {
  51. opacity: 1;
  52. visibility: visible;
  53. }
  54. to {
  55. opacity: 0;
  56. visibility: hidden;
  57. }
  58. }
  59. @keyframes fadein {
  60. from {
  61. opacity: 0;
  62. visibility: hidden;
  63. }
  64. to {
  65. opacity: 1;
  66. visibility: visible;
  67. }
  68. }
  69. @keyframes textalign {
  70. 0%, 20% { text-align: left; }
  71. 50% { text-align: center; }
  72. 80%, 100% { text-align: right; }
  73. }
  74. .fadeout {
  75. animation: 1.2s cubic-in fadeout;
  76. visibility: hidden;
  77. }
  78. .fadein {
  79. animation: 1.2s cubic-out fadein;
  80. }
  81. .textalign {
  82. animation: 1.4s textalign;
  83. }
  84. #exit {
  85. transform: rotate(45deg);
  86. transform-origin: 50% 50% 0;
  87. }
  88. div.container
  89. {
  90. margin-top: 15px;
  91. width: 100%;
  92. height: 200px;
  93. background-color: #ae8484aa;
  94. }
  95. div.plain
  96. {
  97. font-size: 1.2em;
  98. padding: 10px;
  99. margin: auto;
  100. width: 130px;
  101. height: 70px;
  102. background-color: #c66;
  103. }
  104. div.plain:hover { background-color: #ddb700; }
  105. /* -- TRANSFORM TESTS */
  106. #generic {
  107. /* Note the translateX vs translateY in animation target, and rotateZ vs rotate3d, scaleX vs scaleY.
  108. In order to match, they are converted to their generic forms, translate3d, rotate3d, and scale3d.
  109. For rotate3d to match another rotation, their rotation axes must align. */
  110. transform: translateX(100px) rotateZ(70deg) scaleX(1.3);
  111. }
  112. #combine {
  113. transform: rotate(45deg);
  114. }
  115. #decomposition {
  116. /* To interpolate the rotate3d transforms, we need to decompose the matrix,
  117. see the element info in the debugger for the resulting matrix. */
  118. transform: translateX(100px) rotate3d(1.0, 0, 1.0, 0deg);
  119. }
  120. /* -- MIXED UNITS TESTS */
  121. #abs_rel {
  122. margin: 0;
  123. margin-left: 50px;
  124. }
  125. #abs_rel_transform {
  126. margin: 0;
  127. transform: translateX(100%);
  128. }
  129. #animation_event {
  130. position: relative;
  131. margin: 0;
  132. top: 50px; left: 50px;
  133. }
  134. /* -- TRANSITION TESTS */
  135. #transition_test {
  136. /*transition: padding-left 1.6s elastic-in 1.0, background-color 1.2s quadratic-in 1.0, transform 1.3s exponential-in 1.0;*/
  137. transition: padding-left background-color transform 1.6s elastic-out 0.0;
  138. transform: scale(1.0);
  139. }
  140. #transition_test:hover {
  141. /*transition: padding-left background-color transform 0.8s quadratic-out 1.0;*/
  142. padding-left: 60px;
  143. transform: scale(1.5);
  144. }
  145. #transition_class {
  146. margin-left: 50px;
  147. transition: margin-left background-color 0.5s cubic-out;
  148. }
  149. #transition_class.move_me {
  150. margin-left: -50px;
  151. font-size: 22px;
  152. }
  153. /* -- KEYFRAMES TESTS */
  154. @keyframes hello-world
  155. {
  156. 25% {
  157. transform: rotate(180deg);
  158. }
  159. 40% {
  160. transform: rotate(180deg) translateX(200px);
  161. }
  162. 60% {
  163. transform: rotate(180deg) translateX(-200px);
  164. }
  165. 75% {
  166. transform: rotate(180deg);
  167. }
  168. to {
  169. transform: rotate(360deg);
  170. }
  171. }
  172. #keyframes_test
  173. {
  174. transform: rotate(0);
  175. animation: 5s bounce-out infinite hello-world;
  176. transition: background-color 0.5s exponential-in-out;
  177. }
  178. @keyframes some-missing-keys
  179. {
  180. 0%, 30% {
  181. background-color: #d99;
  182. }
  183. 50% {
  184. background-color: #9d9;
  185. }
  186. to {
  187. background-color: #f9f;
  188. width: 100%;
  189. }
  190. }
  191. #keyframes_missing_keys
  192. {
  193. position: relative;
  194. margin: 0; padding: 0;
  195. top: 0; left: 0;
  196. width: 25px; height: 25px;
  197. animation: 2s cubic-in-out infinite alternate some-missing-keys;
  198. }
  199. #keyevent_response
  200. {
  201. position: relative;
  202. margin: 0; padding: 0;
  203. top: 110px; left: 0;
  204. width: 100px; height: 55px;
  205. }
  206. #performance
  207. {
  208. position: absolute;
  209. bottom: 0;
  210. height: 30%;
  211. width: 20%;
  212. left: -100px;
  213. transform: scale(0.5) rotate(-90deg);
  214. }
  215. </style>
  216. </head>
  217. <body template="window">
  218. <div style="width: 20%; height: 80%; position: absolute;">
  219. <div style="font-size: 0.85em; text-align: left;" id="fps"></div>
  220. <button id="start_game">Start Game</button><br />
  221. <button id="high_scores" onkeydown="hello">High Scores</button><br />
  222. <button id="options">Options</button><br />
  223. <button id="help">Help</button><br />
  224. <button id="exit" onclick="exit">Exit</button>
  225. </div>
  226. <div id="performance"/>
  227. <div style="width: 20%; height: 80%;position: absolute; left: 28%;" id="transform_tests">
  228. <div style="font-size: 1.5em; text-align: left;">Test transform animations</div>
  229. <div class="container"><div class="plain" id="generic">Generic form conversion.</div></div>
  230. <div class="container"><div class="plain" id="combine">Match different transform primitive sizes</div></div>
  231. <div class="container"><div class="plain" id="decomposition">Force full matrix decomposition</div></div>
  232. </div>
  233. <div style="width: 20%; height: 80%;position: absolute; left: 52%;" id="mixed_units_tests">
  234. <div style="font-size: 1.5em; text-align: left;">Mixed units tests</div>
  235. <div class="container"><div class="plain" id="abs_rel">Pixel vs percentage.</div></div>
  236. <div class="container"><div class="plain" id="abs_rel_transform">Pixel vs percentage transform.</div></div>
  237. <div class="container"><div class="plain" id="animation_event">Animation event</div><div class="plain" id="keyevent_response">Events (press arrow keys)</div></div>
  238. </div>
  239. <div style="width: 20%; height: 80%;position: absolute; left: 75%;" id="transition_tests">
  240. <div style="font-size: 1.5em; text-align: left;">Transition tests</div>
  241. <div class="container"><div class="plain" id="transition_test">Transition test (hover)</div></div>
  242. <div class="container"><div class="plain" id="transition_class" onclick="add_class">Transition class (click)</div></div>
  243. <div class="container"><div class="plain" id="keyframes_test">Keyframes test</div><div class="plain" id="keyframes_missing_keys"/></div>
  244. </div>
  245. </body>
  246. </rml>