Files
hyperframes/templates/warm-grain/compositions/intro.html
T
Miguel Ángel 44fcc8e8b2 fix(templates): resolve all lint errors and warnings in bundled templates (#197)
## What

Added GSAP CDN imports to all template compositions and improved project linting to skip template placeholders.

## Why

Templates were missing GSAP script imports, causing JavaScript errors when GSAP animations tried to execute. The linter was also incorrectly flagging template placeholder values like `__VIDEO_SRC__` as missing audio sources.

## How

- Added `<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>` to all composition HTML files
- Updated `lintAudioSrcNotFound` function to skip template placeholders matching the pattern `__[A-Z_]+__`
- Fixed GSAP animation properties by adding `overwrite: "auto"` to prevent conflicts
- Replaced CSS transforms with GSAP `gsap.set()` calls for better animation control
- Moved video elements outside timed containers in some templates to avoid nesting issues
- Standardized transcript data format to use double quotes for JSON consistency
- Added proper timeline initialization with `window.__timelines = window.__timelines || {}`
- Enhanced caption styling with overflow handling and max-width constraints

## Test plan

- [x] Manual testing performed
- [x] Verified GSAP animations work correctly in all templates
- [x] Confirmed linter no longer flags template placeholders as errors
- [x] Tested video playback and audio synchronization
2026-04-02 14:38:24 -07:00

88 lines
2.4 KiB
HTML

<template id="intro-template">
<div data-composition-id="intro" data-width="1920" data-height="1080" data-duration="3">
<div class="container">
<div class="title-card">
<h1 class="title">Hyperframes</h1>
<p class="subtitle">Design simplified.</p>
</div>
</div>
<style>
/* Import a rounded humanist sans-serif font */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;600&display=swap");
[data-composition-id="intro"] .container {
width: 100%;
height: 100%;
display: flex;
justify-content: flex-start; /* Align to left for speaker card */
align-items: center;
padding-left: 5%;
font-family: "Outfit", sans-serif;
background: transparent;
}
[data-composition-id="intro"] .title-card {
background-color: #3b5e3a; /* Forest Green for contrast */
padding: 40px 60px;
border-radius: 30px;
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
text-align: left;
opacity: 0;
transform: translateX(-100%); /* Start off-screen left */
}
[data-composition-id="intro"] .title {
font-size: 100px;
font-weight: 600;
color: #f5f0e0; /* Cream text on green card */
margin: 0;
line-height: 1.1;
letter-spacing: -2px;
}
[data-composition-id="intro"] .subtitle {
font-size: 50px;
font-weight: 400;
color: #cc8832; /* Ochre accent */
margin: 10px 0 0 0;
line-height: 1.2;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<script>
(function () {
const tl = gsap.timeline({ paused: true });
// Animation: Speaker card slides in from the left
tl.to(
'[data-composition-id="intro"] .title-card',
{
opacity: 1,
x: 0,
duration: 0.8,
ease: "power2.out",
},
0.2,
);
// Exit: Slide off left at 1.8s (synced with 47% graphic)
tl.to(
'[data-composition-id="intro"] .title-card',
{
x: "-120%",
opacity: 0,
duration: 0.6,
ease: "power2.in",
},
1.8,
);
window.__timelines = window.__timelines || {};
window.__timelines["intro"] = tl;
})();
</script>
</div>
</template>