chore: init
This commit is contained in:
33
examples/animated-sections.js
Normal file
33
examples/animated-sections.js
Normal file
@@ -0,0 +1,33 @@
|
||||
// Animated Sections Example
|
||||
// Scrolls through page to trigger scroll-based animations
|
||||
|
||||
console.log('✨ Triggering scroll animations...');
|
||||
|
||||
// Get all sections
|
||||
const sections = await page.evaluate(() => {
|
||||
const elements = document.querySelectorAll('section, .section, [class*="section"]');
|
||||
return Array.from(elements).map(el => el.offsetTop);
|
||||
});
|
||||
|
||||
console.log(`Found ${sections.length} sections to animate`);
|
||||
|
||||
// Scroll to each section
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
await page.evaluate((top) => {
|
||||
window.scrollTo({ top, behavior: 'smooth' });
|
||||
}, sections[i]);
|
||||
|
||||
console.log(`✓ Scrolled to section ${i + 1}/${sections.length}`);
|
||||
|
||||
// Wait for animations to trigger
|
||||
await new Promise(resolve => setTimeout(resolve, 800));
|
||||
}
|
||||
|
||||
// Scroll back to top
|
||||
await page.evaluate(() => {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
console.log('✓ All animations triggered');
|
||||
Reference in New Issue
Block a user