Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 19 additions & 24 deletions docs/catalog/blocks/canopy-part-title.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { InstallCommand } from "/snippets/install-command.jsx";
title="Canopy Part Title"
description="Leaves sweep through the frame and part to reveal the headline."
variables={[{"id":"headline1","type":"string","label":"Headline 1","default":"Understory"},{"id":"headline2","type":"string","label":"Headline 2","default":"Move slowly"},{"id":"font","type":"string","label":"Headline font","default":"Helvetica"},{"id":"fontWeight","type":"number","label":"Font weight","default":900,"min":100,"max":900,"step":100},{"id":"fontSize","type":"number","label":"Font size (1 = auto-fit)","default":1,"min":0.3,"max":2,"step":0.01},{"id":"letterSpacing","type":"number","label":"Letter spacing (em)","default":0.01,"min":-0.2,"max":1,"step":0.01},{"id":"background","type":"color","label":"Background","default":"#020805"},{"id":"leafCount","type":"number","label":"Leaves per sweep","default":170,"min":40,"max":320,"step":1},{"id":"stayCount","type":"number","label":"Leaves left behind","default":5,"min":0,"max":20,"step":1},{"id":"sweepSpeed","type":"number","label":"Sweep speed","default":1,"min":0.3,"max":3,"step":0.05},{"id":"retainedBreeze","type":"number","label":"Retained leaf breeze","default":1,"min":0,"max":2,"step":0.05}]}
meta={{"duration":12,"width":1920,"height":1080,"category":"3D motion","badge":"Stable","codeLines":1394}}
meta={{"duration":12,"width":1920,"height":1080,"category":"3D motion","badge":"Stable","codeLines":1389}}
attribution={{"path":"registry/blocks/canopy-part-title","tags":["3d-motion","title-card","leaves","organic","depth-of-field","two-headlines","sweep"]}}
hasCode
rawUrl="https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/blocks/canopy-part-title/canopy-part-title.html"
Expand Down Expand Up @@ -131,16 +131,11 @@ import { InstallCommand } from "/snippets/install-command.jsx";
document.getElementById("cpt-scene").appendChild(c);
})();

var V = Object.fromEntries(
JSON.parse(
document
.querySelector("[data-composition-variables]")
.getAttribute("data-composition-variables"),
).map((e) => [e.id, e.default]),
);
// getVariables carries the declared defaults, standalone and mounted.
var V = {};
try {
if (window.__hyperframes && window.__hyperframes.getVariables)
V = Object.assign(V, window.__hyperframes.getVariables() || {});
V = window.__hyperframes.getVariables() || {};
} catch (e) {
/* corrupt declarations must not blank the composition */
}
Expand Down Expand Up @@ -372,31 +367,26 @@ import { InstallCommand } from "/snippets/install-command.jsx";
const W = 1920,
H = 1080,
DUR = 12;
let V = Object.fromEntries(
JSON.parse(
document
.querySelector("[data-composition-variables]")
.getAttribute("data-composition-variables"),
).map((e) => [e.id, e.default]),
);
// Bare __hyperframes is this composition's own in a module; getVariables carries the defaults.
let V = {};
try {
if (window.__hyperframes && window.__hyperframes.getVariables)
V = Object.assign(V, window.__hyperframes.getVariables() || {});
if (typeof __hyperframes !== "undefined" && __hyperframes.getVariables)
V = __hyperframes.getVariables() || {};
} catch (e) {
/* corrupt declarations must not blank the composition */
}
const HEADLINE1 = String(V.headline1 ?? "Understory");
const HEADLINE2 = String(V.headline2 ?? "MOVE SLOWLY");
const HEADLINE2 = String(V.headline2 ?? "Move slowly");
/* Headline typography is a PARAMETER — never a Design-panel edit. Any
Google Fonts family name works; falls back through Gelasio/serif
while (or if never) loading. */
const FONT = (String(V.font || "Gelasio").trim() || "Gelasio").replace(/["']/g, "");
const FONT = (String(V.font || "Helvetica").trim() || "Helvetica").replace(/["']/g, "");
const FONT_WEIGHT = Math.max(
100,
Math.min(
900,
Math.round(
isFinite(Number(V.fontWeight)) && Number(V.fontWeight) ? Number(V.fontWeight) : 500,
isFinite(Number(V.fontWeight)) && Number(V.fontWeight) ? Number(V.fontWeight) : 900,
),
),
);
Expand All @@ -411,7 +401,7 @@ import { InstallCommand } from "/snippets/install-command.jsx";
);
const LETTER_SP = Math.max(
-0.2,
Math.min(1, isFinite(Number(V.letterSpacing)) ? Number(V.letterSpacing) : 0.1),
Math.min(1, isFinite(Number(V.letterSpacing)) ? Number(V.letterSpacing) : 0.01),
);
const FONT_STACK = '"' + FONT + '", Gelasio, Georgia, serif';
if (!/^(Helvetica|Arial|Gelasio|Georgia|serif|sans-serif|monospace)$/i.test(FONT)) {
Expand Down Expand Up @@ -675,10 +665,15 @@ import { InstallCommand } from "/snippets/install-command.jsx";
return { map, bump };
}

// Beside this file when mounted; a runtime without assetUrl keeps the plain path.
const assetUrl = (path) =>
typeof __hyperframes !== "undefined" && __hyperframes.assetUrl
? __hyperframes.assetUrl(path)
: path;
const textureLoader = new THREE.TextureLoader();
const [photoSurface, photoNormal] = await Promise.all([
textureLoader.loadAsync("assets/leaf-surface-color.webp"),
textureLoader.loadAsync("assets/leaf-surface-normal.webp"),
textureLoader.loadAsync(assetUrl("assets/leaf-surface-color.webp")),
textureLoader.loadAsync(assetUrl("assets/leaf-surface-normal.webp")),
]);
photoSurface.colorSpace = THREE.SRGBColorSpace;
photoSurface.wrapS = photoSurface.wrapT = THREE.RepeatWrapping;
Expand Down
5 changes: 3 additions & 2 deletions docs/catalog/blocks/carousel-circle-1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { InstallCommand } from "/snippets/install-command.jsx";
title="Circle Carousel 1"
description="Image cards ride a circle with a size gradient by depth angle, sweeping in fast-slow-fast swings (Circle style 1); 12 image slots."
variables={[{"id":"image1","type":"image","role":"content","label":"Card image 1","description":"Image on card 1 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/223d162eed10f08f.jpg"},{"id":"image2","type":"image","role":"content","label":"Card image 2","description":"Image on card 2 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/5964f78a6c7c55f7.jpg"},{"id":"image3","type":"image","role":"content","label":"Card image 3","description":"Image on card 3 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/e402bbb823b45122.jpg"},{"id":"image4","type":"image","role":"content","label":"Card image 4","description":"Image on card 4 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/25fe4d416b4e318e.jpg"},{"id":"image5","type":"image","role":"content","label":"Card image 5","description":"Image on card 5 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/5360277ad88fe1d4.jpg"},{"id":"image6","type":"image","role":"content","label":"Card image 6","description":"Image on card 6 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/2726d9a6cdc429df.jpg"},{"id":"image7","type":"image","role":"content","label":"Card image 7","description":"Image on card 7 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/9e4c4f735ff68582.jpg"},{"id":"image8","type":"image","role":"content","label":"Card image 8","description":"Image on card 8 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/76ac64af4487c9f1.jpg"},{"id":"image9","type":"image","role":"content","label":"Card image 9","description":"Image on card 9 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/f21ff2ce3281c61a.jpg"},{"id":"image10","type":"image","role":"content","label":"Card image 10","description":"Image on card 10 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/4361229f4648df3d.jpg"},{"id":"image11","type":"image","role":"content","label":"Card image 11","description":"Image on card 11 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/636f8577be7b9849.jpg"},{"id":"image12","type":"image","role":"content","label":"Card image 12","description":"Image on card 12 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/74d11304a8ac596c.jpg"},{"id":"speed","type":"number","role":"style","label":"Speed","description":"Time scale of the carousel motion. 1 = the designed pace.","default":1,"min":0.25,"max":3,"step":0.05},{"id":"background","type":"color","role":"style","label":"Background","description":"Composition ground.","default":"#EDEDEF"}]}
meta={{"duration":6,"width":1920,"height":1080,"category":"Carousels","badge":"Stable","codeLines":1001}}
meta={{"duration":6,"width":1920,"height":1080,"category":"Carousels","badge":"Stable","codeLines":1002}}
attribution={{"author":"Jake Moran","path":"registry/blocks/carousel-circle-1","tags":["carousel","gallery","images","showcase","circle"]}}
hasCode
rawUrl="https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/blocks/carousel-circle-1/carousel-circle-1.html"
Expand Down Expand Up @@ -653,7 +653,8 @@ import { InstallCommand } from "/snippets/install-command.jsx";
const varUrl = (v) => (v && typeof v === "object" ? v.url || v.src || "" : v || "");
if (REG) {
const srcs = REG.imageVars.map(
(id, i) => varUrl(V[id]) || DATA.cards[i % DATA.cards.length].file,
(id, i) =>
varUrl(V[id]) || "assets/carousel-images/" + DATA.cards[i % DATA.cards.length].file,
);
DATA.cards = await Promise.all(
srcs.map(async (src, i) => {
Expand Down
5 changes: 3 additions & 2 deletions docs/catalog/blocks/carousel-circle-2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { InstallCommand } from "/snippets/install-command.jsx";
title="Circle Carousel 2"
description="Image cards ride a circle with a size gradient by depth angle, sweeping in fast-slow-fast swings (Circle style 2); 12 image slots."
variables={[{"id":"image1","type":"image","role":"content","label":"Card image 1","description":"Image on card 1 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/223d162eed10f08f.jpg"},{"id":"image2","type":"image","role":"content","label":"Card image 2","description":"Image on card 2 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/5964f78a6c7c55f7.jpg"},{"id":"image3","type":"image","role":"content","label":"Card image 3","description":"Image on card 3 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/e402bbb823b45122.jpg"},{"id":"image4","type":"image","role":"content","label":"Card image 4","description":"Image on card 4 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/25fe4d416b4e318e.jpg"},{"id":"image5","type":"image","role":"content","label":"Card image 5","description":"Image on card 5 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/5360277ad88fe1d4.jpg"},{"id":"image6","type":"image","role":"content","label":"Card image 6","description":"Image on card 6 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/2726d9a6cdc429df.jpg"},{"id":"image7","type":"image","role":"content","label":"Card image 7","description":"Image on card 7 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/9e4c4f735ff68582.jpg"},{"id":"image8","type":"image","role":"content","label":"Card image 8","description":"Image on card 8 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/76ac64af4487c9f1.jpg"},{"id":"image9","type":"image","role":"content","label":"Card image 9","description":"Image on card 9 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/f21ff2ce3281c61a.jpg"},{"id":"image10","type":"image","role":"content","label":"Card image 10","description":"Image on card 10 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/4361229f4648df3d.jpg"},{"id":"image11","type":"image","role":"content","label":"Card image 11","description":"Image on card 11 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/636f8577be7b9849.jpg"},{"id":"image12","type":"image","role":"content","label":"Card image 12","description":"Image on card 12 of 12. Any aspect; it is fitted into the card box.","portrays":["subject_image"],"default":"https://static.heygen.ai/hyperframes-oss/registry-assets/74d11304a8ac596c.jpg"},{"id":"speed","type":"number","role":"style","label":"Speed","description":"Time scale of the carousel motion. 1 = the designed pace.","default":1,"min":0.25,"max":3,"step":0.05},{"id":"background","type":"color","role":"style","label":"Background","description":"Composition ground.","default":"#EDEDEF"}]}
meta={{"duration":6,"width":1920,"height":1080,"category":"Carousels","badge":"Stable","codeLines":1001}}
meta={{"duration":6,"width":1920,"height":1080,"category":"Carousels","badge":"Stable","codeLines":1002}}
attribution={{"author":"Jake Moran","path":"registry/blocks/carousel-circle-2","tags":["carousel","gallery","images","showcase","circle"]}}
hasCode
rawUrl="https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/blocks/carousel-circle-2/carousel-circle-2.html"
Expand Down Expand Up @@ -653,7 +653,8 @@ import { InstallCommand } from "/snippets/install-command.jsx";
const varUrl = (v) => (v && typeof v === "object" ? v.url || v.src || "" : v || "");
if (REG) {
const srcs = REG.imageVars.map(
(id, i) => varUrl(V[id]) || DATA.cards[i % DATA.cards.length].file,
(id, i) =>
varUrl(V[id]) || "assets/carousel-images/" + DATA.cards[i % DATA.cards.length].file,
);
DATA.cards = await Promise.all(
srcs.map(async (src, i) => {
Expand Down
Loading
Loading