Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vtbag/website. The @vtbag website. ⭐️ Please star to support this work! ⭐️
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104---import Demo from "@/layouts/DemoLayout.astro";---
<Demo title="View Transition Example: Multiple View Transitions, Page 2 of 2" backlink="/basics/examples/#basicac" prev="/demo/BasicAC1/" next="/demo/BasicIM/" description="Demo of a cross-document view transition with multiple animations." image="/bag-og.png"> <link rel="preload" href="/chamber.webp" as="image" slot="early-head" /> <p>You now see page two of this example.</p> <h2>My other lovely picture</h2> <img id="image" width="200" height="200" src="/chamber.webp" alt="The Inspection Chamber" /> <a class="nav-button right" href="/demo/BasicMC1/">Next</a>
<style is:inline slot="late-head"> @media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } } h2 + img { view-transition-name: img; } .nav-button { view-transition-name: nav; } ::view-transition-old(nav) { animation: 1s ease-in-out slideOut; } ::view-transition-new(nav) { animation: 1s ease-in-out slideIn; } @keyframes slideOut { to { transform: translateX(-100vw); } } @keyframes slideIn { from { transform: translateX(100vw); } } ::view-transition-group(img) { z-index: 1; } ::view-transition-old(img) { animation: 1s zoom-out forwards; } ::view-transition-new(img) { animation: 1s reverse zoom-out; } @keyframes zoom-out { 40% { transform: scale(0.5); opacity: 0.5; } 60% { transform: scale(0.5); opacity: 0.5; } 100% { transform: scale(0); opacity: 0; } } .nav-button { position: fixed; transform: translateY(-120px); padding: 10px 20px; background-color: #007bff; color: white; border: none; cursor: pointer; font-size: 16px; border-radius: 5px; } .nav-button.right { right: 20px; } #image { display: block; margin: 0 auto; mask-image: radial-gradient( ellipse at center, white 35%, transparent 71% ); } :active-view-transition { cursor: pointer; } </style></Demo>