Viscose-carousel README

README проекта с github.com/Yousuf-developer/Viscose-carousel. Одним файлом markdown: README.md.

Viscose

A portfolio carousel rendered as a single WebGL shader. Project cards ride a ring that sits mostly off-screen, so you see a tall arc of work sweeping past. Scroll, drag or swipe to turn it; it settles with a card facing front.

Viscose: a viscous state, and a fibre spun by drawing that state into a thread. Which is what the cards do when they pull apart.

License: MIT Next.js Three.js

The carousel at rest in a dark room — Rosso, a red Ferrari Dino, front and
centre with its name set large over it and its red pooled behind it, the
counter, discipline and year beside it, and the index at the right
margin

The cards are not images in a grid. The whole ring is one full-screen fragment shader drawing signed distance fields, which is what lets neighbouring cards melt into one another as they close up and string thin threads as they pull apart. The cursor is a drop of the same stuff: it softens the surface under itself, leans nearby cards toward it, sinks into the card it's over and strings honey back out of it when it leaves.

Read the breakdown → — where the idea came from, how viscosity became a distance field, and the four things that only showed up once it moved.

Quick start

Requires Node 20 or newer.

git clone https://github.com/Yousuf-developer/Viscose-carousel.git
cd Viscose-carousel
npm install
npm run dev

Then open http://localhost:3000.

npm run dev dev server
npm run build production build
npm start serve the build
npm run lint eslint

Built with Next.js 16 (App Router), React 19, Three.js, GSAP and Tailwind v4.

Titles are set in PP Neue Montreal, a commercial face, when its file is present, and fall back to Satoshi (free, bundled) when it is not. See Fonts.

What you can interact with

Pulling out of a card: the cursor's drop has just left the front card's
edge and strings a thread of honey after it, while the ring's own threads run
thin to the neighbours above and below

On the ring the cursor is a drop of the same goo, drawn in the same pass. It trails a tail when it moves, leans over to a card it comes near and melts into its edge. Over a picture it opens into a pill of honey with VIEW cut out of it, so the word is read in the photo underneath. Pull out and it closes back into a drop and strings a thread out of the card that thins and snaps.

The threads are not drawn between the cards — they're part of the same distance field, so they thin, sag and dissolve on their own as the gap opens. The glass lip along the top and bottom edges is refracting the two neighbours into those swept shapes, and that too is the same shader pass.

An opened project: Alhambra at the top at the size it had over the ring,
the Close button on its line at the right, and the card become a wide hero
beneath it — the palace in late sun under the snow of the Sierra
Nevada

Opening is the same material doing one more thing. The card swells in the shader while the rest of the ring backs away and the threads between them stretch and snap; a full-size copy of the image takes over from the atlas cell as it grows, so the picture never leaves the shader. Once the frame has landed it belongs to the page and scrolls with it. Close plays it backwards.

The project page below the hero: the hero passing up through the glass
lip, a strip of facts under its rule and the statement beside it, then the
first of the project's pictures rising — an arch of carved stucco in the
Alhambra

Below the hero the page is laid out as markup but drawn by the same shader: the facts and the statement on one line, then the project's pictures and clips — as many as the set has, up to six — in a rhythm set by their shapes: a large picture on the right and a smaller one on the left, portraits in pairs, a clip across the page. No captions are printed against the pictures; after the opening pictures comes a row of three numbered insights, short notes on the light, the place or the craft. The next project is at the foot. Every picture and every block of type is placed by the layout loop on the box the DOM gave it, exactly — nothing drifts against the scroll — so the whole page bends through the glass lip at the top and bottom of the window as it scrolls, exactly as the ring does. Each piece reveals itself as it is scrolled to.

Some cards have footage. A card that does plays it once the ring has come to rest with it in front, starting on the very frame the card already shows, so the still simply starts to move; it carries on into the hero when the card is opened. On a project page, a clip plays in its box once most of it is in view. One clip plays at a time, through the same shader, so footage bends through the glass lip like everything else. It stays still under prefers-reduced-motion or Save-Data, and wherever the browser refuses to autoplay.

The next project at the foot carries straight on rather than going back through the ring. The page keeps scrolling until that project's name sits where the title was, at the title's size, while its card grows into the hero beneath it. When it arrives the new page is the same frame, so it takes over without a cut, and Close from there returns to the ring on the new project.

The dev panel

In development, press G (or open the page with ?gui) for a lil-gui panel with every tunable in the project — around 140 of them, grouped by what they affect. Drag a slider and the change is live.

It never ships: the panel and lil-gui itself are both behind a dynamic import guarded by NODE_ENV === "development".

Before you tune anything, open the fit folder and check that scale reads 1.000. Every pixel measurement in the project is quoted against a reference window (a 14" MacBook Pro, 1512 points wide). On a different screen you'd be tuning against a scale factor that isn't 1, and the result will look right for you and wrong for everyone else. There's a use this window as ref button that fixes this in one click.

Folder What's in it
fit reference window, scale clamps, the two responsive breakpoints
shape card size, count, ring radius, corner, art crossfade
timing / stage the entry animation
meta the project's name over the card, the block beside it, the morph
room paper, ink, the glow behind the card and the grain
pointer / side cards how the ring reacts to a cursor
honey the threads between cards
glass the refracting lip along the top and bottom edges
open click-to-open: timing, how far the ring backs off, the page
footage whether cards play their clips, how long the ring rests first

Making it yours

Projects

Everything lives in one array, components/ring/projects.js:

{
  file: "alhambra.webp", // the card, and the frame it opens into
  name: "Alhambra",
  type: "Film",
  year: "2025",
  // video: "alhambra.mp4", // optional: the card's own loop, first frame = file
  media: [ // follows it down the page, up to six
    { src: "alhambra-1.webp", shape: "land", caption: "Court of the Myrtles" },
    { src: "alhambra-3.webp", video: "alhambra-3.mp4", shape: "wide",
      caption: "The hill, from dusk to dark" }, // the still is its poster
    { src: "alhambra-4.webp", shape: "port", caption: "Carved arches" },
  ], // each caption is the picture's accessible label, not printed
  insights: [ // three, set as a numbered row after the opening pictures
    { title: "Water", text: "The courts are built around still water…" },
  ],
  blurb: "The Nasrid palaces from first light to floodlight…",
}

Drop the images in public/, add a row, done. The array does four jobs at once — it's the atlas packing order, the order art is dealt around the ring, the project column top-right, and the 01–18 numbering. Reordering rows moves all four together. Only file (and its video, once it is in front) goes on the ring; the rest is asked for when the project is opened.

Any image works, but it is cover-cropped to the card's 3:2, so frame it that way yourself rather than letting the crop decide. 1536×1024 is plenty: the atlas never samples a card above 1024 px wide. Page media are cropped to their shape — land 3:2, port 4:5, wide 16:9 — and the shapes in order decide the layout, so put two portraits next to each other to get a pair. A card's video should be a short seamless loop whose first frame is the card image, so the still can start moving without a cut; a page clip's src is its poster.

The list is in ring order. Entry n sits one slot along the ring from entry n−1, which is what lets the column count up as the carousel turns. Reorder these rows to change the sequence; don't reach for imageOffset, which rotates the art without moving the list with it.

All of the sample data is placeholder: the photographs are Unsplash stock, the clips Mixkit stock, and every name, type, year, caption and blurb is invented. See About the artwork.

Fonts

Three families, declared in app/globals.css and looked up by name from components/ring/params.js — so if you swap one, change it in both places.

Family Used for Weights Licence
Satoshi discipline, header, index column, page 400, 500 Fontshare, free
Geist numbers, years, counters, hint, note 400 OFL
PP Neue Montreal heading, project titles 400 Pangram Pangram, commercial

[!IMPORTANT] PP Neue Montreal is not licensed by this project. It is a commercial typeface from Pangram Pangram and the file is included here for local development and evaluation only. It is not covered by this repo's MIT licence and must not be used for commercial purposes. If you ship anything with it, buy your own licence — or swap textFont in params.js for Satoshi, which is free for commercial work and already included.

Satoshi and Geist are both free to redistribute and use commercially.

Fonts are served as .otf/.ttf (~340 KB total). Converting to woff2 would cut that by roughly 60% — worth doing before this goes anywhere real.

How it's put together

app/
  page.js            renders <Carousel />
  globals.css        Tailwind, @font-face, page background

components/
  Carousel.jsx      the component — renderer, resize, input, per-frame
                     layout, entry timeline
  ring/
    projects.js      the work
    params.js        every tunable
    utils.js         maths helpers
    atlas.js         packs all the art into one texture
    meta.js          the type either side of the ring
    splitText.js     the intro heading
    bead.js          the words the cursor's bead leaves
    gui.js           the dev panel
  shaders/
    planeShaders.js  the ring — SDFs, goo, glass
    textShaders.js   the heading's per-glyph reveal

Two ideas explain most of the rest.

One shader, one draw call. The ring, the threads between cards, the glass lip along the screen edges and the project page are all evaluated per pixel in planeShaders.js. Card positions arrive as uniform arrays, and the fragment shader blends their distance fields with a smooth minimum — that soft blend is the goo.

The ring mid-entry: the cards have begun to peel off the seed and still
cling to one another, fused by thick necks of the same material, the red
Ferrari at the middle of the arc

The entry is the clearest look at what the smooth minimum is doing. Every card starts merged inside the one before it and peels away in sequence, so at any moment during the unfurl some pairs have fully separated, some are joined by a thinning neck, and some are still one blob.

Loading is part of the animation. The atlas binds on the first frame and fills in as images arrive, with the first card's art requested at high priority so it can be shown while the rest are still downloading. The counter at the bottom of the screen isn't a readout beside the entry — it is the gate. The seed card is born, holds at centre, and the ring launches on the frame the number reaches 100.

For the deeper technical notes — coordinate conventions, the responsive model, and the handful of things here that look like bugs but aren't — see AGENTS.md.

Status

This is a work in progress, published because the rendering approach might be useful to someone. Known gaps:

Contributing

Issues and pull requests are welcome.

Credits

License

MIT for the source code. Not for anything in public/.

About the artwork

The project images and clips are placeholders, not my work. Every picture is a photograph published on Unsplash under the Unsplash License, and every clip is from Mixkit under the Mixkit Stock Video Free License. Both allow free use without attribution; they're credited here anyway. Each was cropped to its box, given the same warm, lightly matte grade, and resized; the clips were cut into short seamless loops. public/sm/ holds smaller copies of the pictures — the cards at half size, the page pictures cut for a phone — which phones and tablets load instead.

They were picked as sets, not as a hundred good pictures: one shoot or one place per project — classic cars, architecture, gardens and ruins in warm southern light — so a page reads as one piece of work and the ring reads as one body. Ordered around the ring as a colour wheel, with dark, light and mid cards alternating, because neighbours melt into each other.

Project Credits: the card, then the page in order
Rosso Joost Crop · Adrian Newell · Carlo D'Agnolo · Matthieu Rochette · yokatan · Matthieu Rochette · D Panyukov
Salk Adam Bignell · mathilda janzon · Adam Bignell · Adam Bignell · Adam Bignell
Muralla Lena Polishko · Lena Polishko · Lena Polishko · Lena Polishko · Lena Polishko · Lena Polishko
Petra Moxin Wang · Brian Kairuz · Emile Guillemot · Spencer Davis · Spencer Davis · Filippo Cesarini
Concordia Pier Averara · Casey Lovegrove · Casey Lovegrove · Casey Lovegrove · Ricardo Gomez Angel · Raffaele Reccia
Alhambra Jorge Fernández Salas · Austin Gardner · FotoFlo · Dan Dubassy, Mixkit · Izuddin Helmi Adnan · Izuddin Helmi Adnan · Petr Slováček
Majorelle Riccardo Monteleone · mathieu gauzy · mathieu gauzy · mathieu gauzy
Olive Max · Vasilis Caravitis · Kostas Morfiris · Anastasia Zhenina · Don Fontijn
Mesa Hunter Owens · Hunter Owens · Radek Skrzypczak · Don Stouder · grant morris · Cody Board
Havana Dan Dubassy, Mixkit · Dan Dubassy, Mixkit · Dan Dubassy, Mixkit
Piscina Dan Dubassy, Mixkit · Francisco Fonseca, Mixkit · Aran Mtnez · Dan Dubassy, Mixkit
Riva Roger Starnes Sr · Jon Flobrant · Roger Starnes Sr · Marco López, Mixkit · John Cameron · Evan Verni · Panos Tsilivis
Forum Matteo del Piano · Massimo Virgilio · Massimo Virgilio · Torkos Akos · Jens Peter Olesen · Jorge Salazar
Positano Letizia Agosta · Léa · Sander Crombach · Dan Dubassy, Mixkit · Jordan Steranka · Ricardo Gomez Angel · Sebastian Leonhardt
Hothouse Samuel Hagger · Max Letek · Chris Boland · Kristaps Grundsteins · Floor van Lent · Samuel Hagger
Carrera Valdemaras Januška · Luke Miller · George Bale · Jonatan Hernandez · Edgar Guerra · Hamza Şamil Yavuz · yokatan
Gullwing Quentin Martinez · Quentin Martinez · Quentin Martinez · Georg Eiermann · Quentin Martinez · Tim D · Quentin Martinez
Spiral Carlos Torres · Nicolas Hoizey · Jean-Luc Benazet · Dan Freeman · Serhat Beyazkaya · Ludde Lorentz

The MIT licence above does not extend to them; the Unsplash License and the Mixkit License are what cover their use. The names, disciplines and years shown next to them are invented and are not claims about who made what. If you fork this, replace the images with your own work.

If you took one of these and would rather it wasn't here, please open an issue and it comes straight out.

The bundled PP Neue Montreal is likewise not licensed by this project — see Fonts.

Viscose-carousel (Yousuf-developer/Viscose-carousel)

Ищем в базе…

Что это?Viscose — карусель для портфолио, полностью отрисованная одним фрагментным шейдером WebGL. Карточки сидят на кольце, по большей части спрятанном за экраном: сходясь, они плавятся друг в друга, как жидкость, а расходясь — протягивают между собой тонкие нити.
Это готовый плагин или шаблон, на котором я строю своё?Это приложение/шаблон на Next.js, которое вы клонируете и кастомизируете, а не npm-пакет. Вся логика шейдера, кольца и проектов лежит в папках components/ring/ и components/shaders/, чтобы вы могли править её напрямую.
Как это запустить?Склонируйте репозиторий, установите зависимости через npm (нужен Node 20+), затем выполните npm run dev, чтобы запустить dev-сервер Next.js.
Какой стек технологий стоит за эффектом шейдера?Он построен на Next.js и React, где Three.js управляет WebGL-рендерингом, GSAP отвечает за анимацию, а lil-gui — за панель настройки, доступную только в dev-режиме.
Открывает ли клик по карточке сам проект?Нет — клик по карточке лишь центрирует её; тег «View» обещает пункт назначения, которого пока не существует. Ещё нет поддержки reduced-motion, нет навигации с клавиатуры, а из автоматических проверок — только линт и сборка.
Кто вообще будет этим пользоваться?Разработчики и дизайнеры, которым нужна эффектная, собранная под себя карусель для портфолио и которые готовы сами править код шейдера и настраивать ~136 параметров, — а не те, кому нужен виджет «вставил и работает».
Где это работает — в любом браузере?Работает в любом современном браузере, адаптируясь вплоть до ширины телефона, хотя автор отмечает, что узкий брейкпоинт смещается ниже ~500px.
Можно ли коммерчески использовать включённые изображения и шрифты?Лицензия MIT покрывает только исходный код — примеры изображений с Behance и входящий шрифт PP Neue Montreal не покрыты и для коммерческого использования должны быть заменены или отдельно лицензированы.
Как добавить свои проекты на кольцо?Всё лежит в одном массиве в components/ring/projects.js — положите картинку в public/ и добавьте строку. Учтите: порядок списка — это порядок на кольце, а не по имени файла, так что перестановка строк меняет последовательность.
Как на самом деле работает эффект плавления и нитей?Всё кольцо, нити, стеклянная кромка и подпись у курсора рисуются за один проход шейдера с помощью полей знаковых расстояний, смешанных через smooth minimum, — именно это мягкое смешение заставляет соседние карточки выглядеть слипающимися и расходящимися, как тягучая масса.
Что происходит на сенсорных устройствах, раз hover нет?Свайп вращает кольцо, а жест нажатия с удержанием вызывает эффекты наведения, ведь у пальца нет собственного состояния hover.
Почему перед запуском карусели появляется счётчик загрузки?Счётчик — не просто индикатор, а шлюз: кольцо запускается, только когда счётчик достигает 100, пока позади него заполняется атлас текстур, причём арт первой карточки в приоритете.
Какие есть похожие проекты?canvas-ui, swarm-cursors, LinearAbilityExtThreeJS, dioramas, plasma-ui, sylva, clay-safari, simplefolio
Размер
63.6 MB
Звёзды
528
Обновлён
КоммитOct 23
Возраст
3 мес
Коммиты · 90 дней