|
| 1 | +--- |
| 2 | +title: "Flowing Gradient" |
| 3 | +description: "Bands of orange and violet flow across the frame in a smooth gradient. A WebGPU shader from the Shaders library (shaders.com, MIT)." |
| 4 | +mode: "frame" |
| 5 | +--- |
| 6 | + |
| 7 | +import { CatalogDetail, CatalogSlot } from "/snippets/catalog-detail.jsx"; |
| 8 | +import { InstallCommand } from "/snippets/install-command.jsx"; |
| 9 | + |
| 10 | +<CatalogDetail |
| 11 | + previewSrc="/public/catalog/blocks/flowing-gradient.json" |
| 12 | + compositionId="flowing-gradient" |
| 13 | + compositionSrc="compositions/flowing-gradient.html" |
| 14 | + title="Flowing Gradient" |
| 15 | + description="Bands of orange and violet flow across the frame in a smooth gradient. A WebGPU shader from the Shaders library (shaders.com, MIT)." |
| 16 | + variables={[]} |
| 17 | + meta={{"duration":2,"width":1920,"height":1080,"category":"Blocks","badge":"Stable","codeLines":31}} |
| 18 | + attribution={{"path":"registry/blocks/flowing-gradient","tags":["webgpu","webgpu-shader","background","gradient","color","flow"]}} |
| 19 | + video="https://static.heygen.ai/hyperframes-oss/docs/images/catalog/blocks/flowing-gradient.mp4" |
| 20 | + webgpu |
| 21 | + hasCode |
| 22 | + rawUrl="https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/blocks/flowing-gradient/flowing-gradient.html" |
| 23 | +> |
| 24 | + |
| 25 | +<CatalogSlot slot="code"> |
| 26 | + |
| 27 | +```html flowing-gradient.html |
| 28 | +<!doctype html> |
| 29 | +<html> |
| 30 | + <head> |
| 31 | + <meta charset="utf-8" /> |
| 32 | + <style> |
| 33 | + [data-composition-id="flowing-gradient"] canvas[data-shader] { |
| 34 | + position: absolute; |
| 35 | + inset: 0; |
| 36 | + width: 1920px; |
| 37 | + height: 1080px; |
| 38 | + display: block; |
| 39 | + background: #000; |
| 40 | + } |
| 41 | + </style> |
| 42 | + </head> |
| 43 | + <body> |
| 44 | + <div |
| 45 | + data-composition-id="flowing-gradient" |
| 46 | + data-start="0" |
| 47 | + data-duration="2" |
| 48 | + data-width="1920" |
| 49 | + data-height="1080" |
| 50 | + data-requires-webgpu |
| 51 | + data-no-timeline |
| 52 | + style="position: relative; width: 1920px; height: 1080px; overflow: hidden; background: #000" |
| 53 | + > |
| 54 | + <canvas data-shader="FlowingGradient" width="1920" height="1080"></canvas> |
| 55 | + </div> |
| 56 | + <script src="lib/shaders.iife.js"></script> |
| 57 | + </body> |
| 58 | +</html> |
| 59 | +``` |
| 60 | + |
| 61 | +</CatalogSlot> |
| 62 | + |
| 63 | +<CatalogSlot slot="install"> |
| 64 | + |
| 65 | +<InstallCommand command="npx hyperframes add flowing-gradient" item="flowing-gradient" /> |
| 66 | + |
| 67 | +That writes `compositions/flowing-gradient.html`, plus 2 supporting files under `compositions/lib/`. |
| 68 | + |
| 69 | +</CatalogSlot> |
| 70 | + |
| 71 | +<CatalogSlot slot="docs"> |
| 72 | + |
| 73 | +## Add it to your video |
| 74 | + |
| 75 | +It runs for 2 seconds at 1920×1080. Paste this into your composition: |
| 76 | + |
| 77 | +```html index.html |
| 78 | +<div |
| 79 | + data-composition-id="flowing-gradient" |
| 80 | + data-composition-src="compositions/flowing-gradient.html" |
| 81 | + data-start="0" |
| 82 | + data-duration="2" |
| 83 | + data-track-index="1" |
| 84 | + data-width="1920" |
| 85 | + data-height="1080" |
| 86 | +></div> |
| 87 | +``` |
| 88 | + |
| 89 | +Move it in time with `data-start`. Put it on a different timeline row with |
| 90 | +`data-track-index`. See [data attributes](/concepts/data-attributes) for the rest. |
| 91 | + |
| 92 | +{/* hf:generated-footer */} |
| 93 | + |
| 94 | +Tagged `webgpu` `webgpu-shader` `background` `gradient` `color` `flow`. |
| 95 | + |
| 96 | +## Related topics |
| 97 | + |
| 98 | +- [Browse the complete Catalog](/catalog) |
| 99 | +- [Add assets and Catalog items in Studio](/studio/assets-and-blocks) |
| 100 | +- [Build a richer composition](/go-further) |
| 101 | + |
| 102 | +</CatalogSlot> |
| 103 | + |
| 104 | +</CatalogDetail> |
0 commit comments