shader_conic_gradient.rml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <rml>
  2. <head>
  3. <title>conic-gradient</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <meta name="Description" content="A variety of conic-gradient backgrounds. Each group should match their description." />
  6. <meta name="Backend" content="Requires backend support for rendering with compiled shaders." />
  7. <link rel="source" href="https://www.w3.org/TR/css-images-4/#conic-gradients" />
  8. <style>
  9. body {
  10. background: #ddd;
  11. color: #444;
  12. width: 900dp;
  13. }
  14. div {
  15. margin: 5dp;
  16. width: 200dp;
  17. height: 100dp;
  18. box-sizing: border-box;
  19. border: 1dp #bbb;
  20. float: left;
  21. }
  22. group {
  23. margin-left: 1em;
  24. display: flow-root;
  25. margin-bottom: 1em;
  26. }
  27. button {
  28. decorator: repeating-conic-gradient(from 90deg, #ffd700, #f06, #ffd700 180deg);
  29. display: block;
  30. width: 200dp;
  31. box-sizing: border-box;
  32. border-radius: 15dp;
  33. border: 3dp #ffd700;
  34. padding: 10dp 35dp;
  35. margin-top: 5dp;
  36. font-size: 30dp;
  37. color: white;
  38. font-effect: glow(3dp #ff6a), outline(2dp #0003);
  39. font-weight: bold;
  40. letter-spacing: 1dp;
  41. text-align: center;
  42. }
  43. .basic > :nth-child(1) { decorator: conic-gradient(#f06, #ffd700); }
  44. .basic > :nth-child(2) { decorator: conic-gradient(at 50% 50%, #f06, #ffd700); }
  45. .basic > :nth-child(3) { decorator: conic-gradient(from 0deg, #f06, #ffd700); }
  46. .basic > :nth-child(4) { decorator: conic-gradient(from 0deg at center, #f06, #ffd700); }
  47. .basic > :nth-child(5) { decorator: conic-gradient(#f06 0%, #ffd700 100%); }
  48. .basic > :nth-child(6) { decorator: conic-gradient(#f06 0deg, #ffd700 360deg); }
  49. .basic > :nth-child(7) { decorator: conic-gradient(#f06 0deg 0deg, #ffd700 360deg 360deg); }
  50. .basic > :nth-child(8) { decorator: conic-gradient(#f06 0 0, #ffd700 360deg 100%); }
  51. .position > :nth-child(1) { decorator: conic-gradient(at 25% 30%, #f06, #ffd700 60%); }
  52. .position > :nth-child(2) { decorator: conic-gradient(at 25% 30%, #f06, #ffd700 60%); }
  53. .position > :nth-child(3) { decorator: conic-gradient(from 0deg at 25% 30%, #f06, #ffd700 60%); }
  54. .position > :nth-child(4) { decorator: conic-gradient(from 0deg at 25% 30%, #f06, #ffd700 60%); }
  55. .angle_outside > :nth-child(1) { decorator: conic-gradient(white -50%, black 150%); }
  56. .angle_outside > :nth-child(2) { decorator: conic-gradient(white -180deg, black 540deg); }
  57. .cone > :nth-child(1) { decorator: conic-gradient(white, black, white); }
  58. .cone > :nth-child(2) { decorator: conic-gradient(from 45deg, white, black, white); }
  59. .color_wheel > div {
  60. border-radius: 100dp;
  61. width: 200dp; height: 200dp;
  62. }
  63. .color_wheel > :nth-child(1) { decorator: radial-gradient(white, #fff3 65%, transparent), conic-gradient(red, yellow, lime, aqua, blue, #f0f, red); }
  64. .color_wheel > :nth-child(2) { decorator: conic-gradient(#9acd32 40%, #ffd700 0 75%, #f06 0); }
  65. .color_wheel > :nth-child(3) { decorator: conic-gradient(black 25%, white 0 50%, black 0 75%, white 0); }
  66. @keyframes spinner {
  67. from { decorator: repeating-conic-gradient(from 0deg, #fff3 0 15deg, #fff0 0 30deg); }
  68. to { decorator: repeating-conic-gradient(from 360deg, #fff3 0 15deg, #fff0 0 30deg); }
  69. }
  70. .repeating > :nth-child(1) { decorator: repeating-conic-gradient(#ffd700, #f06 20deg); }
  71. .repeating > :nth-child(2) { background: #0ac; animation: 5s spinner infinite; }
  72. </style>
  73. </head>
  74. <body>
  75. Button with repeating conic gradient
  76. <group>
  77. <button>Button</button>
  78. </group>
  79. Red to gold clockwise, from top [equivalent]
  80. <group class="basic">
  81. <div/>
  82. <div/>
  83. <div/>
  84. <div/>
  85. <div/>
  86. <div/>
  87. <div/>
  88. <div/>
  89. </group>
  90. Positioned red to gold clockwise, from top [equivalent]
  91. <group class="position">
  92. <div/>
  93. <div/>
  94. <div/>
  95. <div/>
  96. </group>
  97. Light gray to dark gray, from top [equivalent]
  98. <group class="angle_outside">
  99. <div/>
  100. <div/>
  101. </group>
  102. Smooth cone
  103. <group class="cone">
  104. <div/>
  105. <div/>
  106. </group>
  107. Color wheel, pie chart, and checkerboard
  108. <group class="color_wheel">
  109. <div/>
  110. <div/>
  111. <div/>
  112. </group>
  113. Repeating
  114. <group class="repeating">
  115. <div/>
  116. <div/>
  117. </group>
  118. </body>
  119. </rml>