Layout
How many slides are in view, how far they are apart, which way they go: all of it is CSS, and the script measures what the page lays out.
The script measures what the page lays out, so responsive settings are media queries:
.gs { --gs-per-view: 1.2; --gs-gap: 12px; }
@media (min-width: 960px) {
.gs { --gs-per-view: 3; }
}
Give the slides a height, an aspect-ratio, or use autoHeight().
The slider moves slides with translate. Their transform, scale and rotate are yours: a slide that grows under the pointer, or is smaller the further it is from the middle. A scaled slide is measured as large as it is laid out, around its middle. The canvas draws slides where they are laid out: with it, an effect or draw() moves them.
.gs-slide { transition: scale 0.3s; }
.gs-slide:hover { scale: 1.04; }
/* With progress(): smaller the further from the middle. */
.gs-slide { scale: calc( 1 - var( --gs-away, 0 ) * 0.1 ); }
Corners
Round corners are border-radius, on the image or on a slide that clips it; corner-shape makes them a squircle, or any superellipse(). The canvas reads both and draws the same corners, through every effect and transition:
.gs-slide {
border-radius: 24px;
corner-shape: squircle;
overflow: hidden;
}
The radius of the top left corner is the one of all four. Where a browser has no corner-shape (so far Chrome and Edge have it), the corners are round, on the page and on the canvas alike.
Downwards
createSlider( element, { axis: 'y' } );
.gs { height: 70vh; --gs-per-view: 1.5; }
The slides follow each other downwards: drag up and down, arrow up and down, the wheel as it is. At its ends the wheel scrolls the page. The slider needs a height. Effects are written for a row and are turned with the slider.
Rows
Nothing of the script: a grid that flows in columns. A column is a snap.
.gs-track {
display: grid;
grid-auto-flow: column;
grid-template-rows: repeat( 2, 1fr );
grid-auto-columns: calc( ( 100% - 2 * var(--gs-gap) ) / 3 );
gap: var(--gs-gap);
}
Focus point
.gs { --gs-focus: 30% 70%; }
What object-position is for an image: the point that stays in view when the image is cut. The canvas takes it from the page.







