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.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051---import Demo from '@/layouts/DemoLayout.astro';import Tabs from './_Tabs.astro';---<Demo title="View Transition Example: Custom Animation (Same-Document)" backlink='/basics/examples/#basicas' prev="/demo/BasicS/" next="/demo/BasicMS/" description="A custom same-document view transition animation that shrinks the old image on exit and enlarges the new image on entry." image="/bag-og.png"> <p> This example defines a custom animation to transition between tabs. </p><Tabs /><style is:inline slot="late-head"> #tab1 { view-transition-name: tab1; } #tab2 { view-transition-name: tab2; } ::view-transition-old(tab1), ::view-transition-old(tab2) { animation: shrink 0.2s forwards; transform-origin: top; } ::view-transition-new(tab1), ::view-transition-new(tab2) { animation: grow 0.8s 0.2s backwards; transform-origin: top; } @keyframes shrink {to {transform: scaleY(0)}} @keyframes grow {from {transform: scaleY(0)}} .tab { display: inline-block; padding: 10px 20px; cursor: pointer; background-color: #887; border: 1px solid #887; border-bottom: none; } .tab.active { background-color: #797; border-bottom: 1px solid #797; } .tab-content { display: none; padding: 20px; border: 1px solid #888; } .tab-content.active { display: block; }</style></Demo>