Журнал Тильды
/
Библиотека промптов
/
Портфолио для сайта: карточки собираются в стопку при скролле
Галерея и слайдеры, Анимация
Портфолио для сайта: карточки собираются в стопку при скролле
Блок портфолио с анимацией скролла: карточки проектов съезжаются в стопку и по очереди уходят вниз. Для фотографа и дизайнера.
Промпт
Вы можете скопировать промпт и вставить его в вайб блок в поле ввода. Подробнее в инструкции.
Создай портфолио: 5 фотокарточек при скролле собираются из диагонали в стопку, затем уходят вниз и возвращаются за неё. Без заголовка, кнопок, ссылок и индикаторов.

Контент в HTML: 5 article, img data-tilda-img="y", названия/номера data-tilda-edit="y". Без генерации контента через JS/массивы/innerHTML/canvas и клонирования. JS только анимирует. В редакторе все карточки сеткой, фото/тексты редактируемы, без sticky и перехвата кликов.

Фон #e1e2e5, Arial. Sticky-сцена top:0, height:100svh, overflow:clip. Рабочая область inset:100px 40px 80px, perspective:1600px. Карточки по центру absolute, квадратные, radius:18px, белая рамка 1px/.09, тень. Фото на всю площадь, object-fit:cover center, saturate(.8). Затемнение: rgba(8,8,10,.04) 0%, .03 на 38%, .24 на 58%, .70 на 74%, .90 на 100%.

Подписи внизу, отступы 5%: название слева, номер справа. Название #efeff0, regular, line-height:1.12, трекинг -.045em, font-size:clamp(18px,S*.055,32px); номер #cdced1, clamp(10px,S*.022,12px). Без описаний.

Название | номер | фото:
Gather | 01 / Selected work | https://static.tildacdn.com/tild6538-3839-4830-b133-336538343834/_____1.jpg
Daylight | 02 / Selected work | https://static.tildacdn.com/tild3766-3561-4134-b436-666634373463/____1.jpg
Next Chapter | 03 / Selected work | https://static.tildacdn.com/tild3263-3832-4236-a236-623861323861/_____1.jpg
Monday Club | 04 / Selected work | https://static.tildacdn.com/tild6263-3037-4665-a662-346637386232/_____1.jpg
Parallel | 05 / Selected work | https://static.tildacdn.com/tild6431-6330-4338-a436-373635616263/_____1.jpg

Скролл-анимация обратима. H=высота sticky, W/B=ширина/высота рабочей области. Узкий режим при W<600px. Размер S=min(560px,W*(узкий?.9:.68),B*.78). Высота секции 7.53H. Цель t=clamp(-sectionRect.top/H,0,6.53); сглаживание rAF: tSmooth+=(t-tSmooth)*(1-exp(-dt/105)), dt≤64ms. Easing E(u)=u³*(u*(6u-15)+10).

Начало: карточки без вращения, увеличены в 1.28 раза (узкий:1.16). Для индекса i=0…4: x=(1.35-i)*initialSize*.62, y=(1.35-i)*initialSize*.5; в узком режиме множители .42/.6. Первая впереди, остальные уходят по диагонали вверх-влево.
0… .22H — пауза. Следующие 1.15H — сборка в стопку через E, задержки 0…22% фазы, завершение общее.
Поза стопки ранга r: scale=.925^r, x=0, y=-(1-scale)*S/2-r*gap; gap=min(S*.041,(B-S)*.44/4).

Пауза .34H. С t=1.71 идут 4 перелистывания по 1.08H. Цикл: 12% пауза, 82% полёт. Первые 46% полёта: передняя карточка опускается к x=.045S,y=1.06S, scale:1.035, rotateX:-9°, rotateZ:1.5°, поверх остальных. Затем уходит назад по z-index и в позу ранга 4. Остальные плавно продвигаются на ранг вперёд. Easing E. В конце Parallel впереди, пауза .5H, затем обычный скролл страницы. Без autoplay/hover.

≤600px рабочая область inset:80px 20px 72px; тот же эффект. При высоте окна ≤600px и ширине >600px inset:65px 32px 55px. При resize/изменении списка пересчитывай геометрию. Изолируй CSS/JS. Без JS и при reduced-motion — статичная сетка auto-fit minmax(280px,1fr), gap:20px, без sticky.
Скопировать промпт
Код
Вы можете скопировать код и вставить его в вайб блок в раздел код. Подробнее в инструкции.
<style>
.vf-projects {
--vf-background: #e1e2e5;
--vf-text: #232325;
--vf-radius: 18px;
position: relative;
width: 100%;
color: var(--vf-text);
background: var(--vf-background);
font-family: Arial, Helvetica, sans-serif;
isolation: isolate;
}
.vf-projects *, .vf-projects *::before, .vf-projects *::after {
box-sizing: border-box;
}
.vf-projects h3, .vf-projects p { margin: 0; }
.vf-projects .vf-stage {
position: relative;
padding: 36px 40px;
}
.vf-projects .vf-topbar, .vf-projects .vf-bottom-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
font-size: 12px;
line-height: 1.4;
}
.vf-projects .vf-topbar { margin-bottom: 40px; }
.vf-projects .vf-label { font-size: 14px; }
.vf-projects .vf-description {
color: #727277;
text-align: right;
}
.vf-projects .vf-bottom-bar {
margin-top: 40px;
color: #727277;
}
.vf-projects .vf-scroll-hint { display: none; }
.vf-projects .vf-scroll-hint span {
display: inline-block;
margin-right: 10px;
}
.vf-projects .vf-progress {
display: none;
width: 132px;
height: 2px;
overflow: hidden;
background: rgba(35, 35, 37, .15);
}
.vf-projects .vf-progress-fill {
display: block;
width: 100%;
height: 100%;
background: var(--vf-text);
transform: scaleX(0);
transform-origin: left;
}
.vf-projects .vf-scene {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
gap: 20px;
perspective: 1600px;
}
.vf-projects .vf-card {
--vf-card-color: #303032;
position: relative;
width: 100%;
aspect-ratio: 1;
overflow: hidden;
color: #efeff0;
border: 1px solid rgba(255, 255, 255, .09);
border-radius: var(--vf-radius);
background: linear-gradient(
170deg,
var(--vf-card-color) 0%,
#202021 43%,
#090909 100%
);
box-shadow: 0 12px 32px -22px rgba(0, 0, 0, .4);
transform-origin: center;
backface-visibility: hidden;
}
.vf-projects .vf-card-image {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
filter: saturate(.8);
}
.vf-projects .vf-card::before {
content: "";
position: absolute;
inset: 0;
z-index: 1;
background: linear-gradient(
180deg,
rgba(8, 8, 10, .04) 0%,
rgba(8, 8, 10, .03) 38%,
rgba(8, 8, 10, .24) 58%,
rgba(8, 8, 10, .70) 74%,
rgba(8, 8, 10, .90) 100%
);
pointer-events: none;
}
.vf-projects .vf-card-heading {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 16px;
}
.vf-projects .vf-card-title {
min-width: 0;
font-size: clamp(18px, calc(var(--vf-size, 440px) * .055), 32px);
font-weight: 400;
line-height: 1.12;
letter-spacing: -.045em;
overflow-wrap: anywhere;
}
.vf-projects .vf-card-meta {
display: flex;
flex-wrap: wrap;
gap: 24px;
font-size: clamp(10px, calc(var(--vf-size, 440px) * .021), 12px);
line-height: 1.4;
color: #efeff0;
}
.vf-projects .vf-card-meta span { color: #cdced1; }
.vf-projects .vf-card-bottom {
position: absolute;
z-index: 3;
right: 5%;
bottom: 5%;
left: 5%;
display: grid;
gap: 12px;
}
.vf-projects .vf-project-number {
flex-shrink: 0;
color: #cdced1;
font-size: clamp(10px, calc(var(--vf-size, 440px) * .022), 12px);
line-height: 1.4;
white-space: nowrap;
}
.vf-projects .vf-card:nth-child(2) { --vf-card-color: #2b3030; }
.vf-projects .vf-card:nth-child(3) { --vf-card-color: #302d32; }
.vf-projects .vf-card:nth-child(4) { --vf-card-color: #302e29; }
.vf-projects .vf-card:nth-child(5) { --vf-card-color: #2b2f34; }

.vf-projects.vf-ready .vf-stage {
position: sticky;
top: 0;
height: 100vh;
height: 100svh;
padding: 0;
overflow: hidden;
overflow: clip;
}
.vf-projects.vf-ready .vf-topbar {
position: absolute;
top: 36px;
right: 40px;
left: 40px;
z-index: 2;
margin: 0;
color: #ffffff;
mix-blend-mode: difference;
}
.vf-projects.vf-ready .vf-description {
color: inherit;
opacity: .65;
}
.vf-projects.vf-ready .vf-scene {
position: absolute;
inset: 100px 40px 80px;
display: block;
}
.vf-projects.vf-ready .vf-card {
position: absolute;
top: 50%;
left: 50%;
width: var(--vf-size, 440px);
transform: translate(-50%, -50%);
will-change: transform;
}
.vf-projects.vf-ready .vf-bottom-bar {
position: absolute;
right: 40px;
bottom: 32px;
left: 40px;
margin: 0;
z-index: 2;
color: #ffffff;
mix-blend-mode: difference;
}
.vf-projects.vf-ready .vf-scroll-hint { display: block; }
.vf-projects.vf-ready .vf-progress {
display: block;
background: rgba(255, 255, 255, .15);
}
.vf-projects.vf-ready .vf-progress-fill {
background: #ffffff;
}

@media (max-width: 600px) {
.vf-projects .vf-stage { padding: 24px 20px; }
.vf-projects .vf-topbar { gap: 16px; }
.vf-projects .vf-label { font-size: 13px; }
.vf-projects .vf-description {
max-width: 140px;
font-size: 10px;
}
.vf-projects.vf-ready .vf-topbar {
top: 24px;
right: 20px;
left: 20px;
}
.vf-projects.vf-ready .vf-scene {
inset: 80px 20px 72px;
}
.vf-projects.vf-ready .vf-bottom-bar {
right: 20px;
bottom: 28px;
left: 20px;
}
.vf-projects .vf-progress { width: 86px; }
.vf-projects .vf-card-heading { gap: 12px; }
.vf-projects .vf-card-bottom { gap: 10px; }
.vf-projects .vf-card-meta { gap: 20px; }
}

@media (max-height: 600px) and (min-width: 601px) {
.vf-projects.vf-ready .vf-topbar { top: 20px; }
.vf-projects.vf-ready .vf-scene {
inset: 65px 32px 55px;
}
.vf-projects.vf-ready .vf-bottom-bar { bottom: 20px; }
}
</style> <section class="vf-projects" aria-label="Selected design projects"> <div class="vf-stage"> <header class="vf-topbar"> </header> <div class="vf-scene"> <article class="vf-card"> <img class="vf-card-image" src="https://static.tildacdn.com/tild6538-3839-4830-b133-336538343834/_____1.jpg" alt="Modern coworking space with glass meeting rooms and a lounge" width="1000" height="1000" loading="eager" decoding="async" fetchpriority="high"> <footer class="vf-card-bottom"> <div class="vf-card-heading"> <h3 class="vf-card-title">Gather</h3> <p class="vf-project-number">01 / Selected work</p> </div> <div class="vf-card-meta"> <p></p> <p></p> </div> </footer> </article> <article class="vf-card"> <img class="vf-card-image" src="https://static.tildacdn.com/tild3766-3561-4134-b436-666634373463/____1.jpg" alt="Shared coworking desks with computers, plants and linear lighting" width="1000" height="1000" loading="eager" decoding="async"> <footer class="vf-card-bottom"> <div class="vf-card-heading"> <h3 class="vf-card-title">Daylight</h3> <p class="vf-project-number">02 / Selected work</p> </div> <div class="vf-card-meta"> </div> </footer> </article> <article class="vf-card"> <img class="vf-card-image" src="https://static.tildacdn.com/tild3263-3832-4236-a236-623861323861/_____1.jpg" alt="Bright shared office with a communal table and comfortable chairs" width="1000" height="1000" loading="eager" decoding="async"> <footer class="vf-card-bottom"> <div class="vf-card-heading"> <h3 class="vf-card-title">Next Chapter</h3> <p class="vf-project-number">03 / Selected work</p> </div> <div class="vf-card-meta"> <p></p> <p></p> </div> </footer> </article> <article class="vf-card"> <img class="vf-card-image" src="https://static.tildacdn.com/tild6263-3037-4665-a662-346637386232/_____1.jpg" alt="Open coworking space with shared workstations and blue acoustic partitions" width="1000" height="1000" loading="eager" decoding="async"> <footer class="vf-card-bottom"> <div class="vf-card-heading"> <h3 class="vf-card-title">Monday Club</h3> <p class="vf-project-number">04 / Selected work</p> </div> <div class="vf-card-meta"> <p></p> <p></p> </div> </footer> </article> <article class="vf-card"> <img class="vf-card-image" src="https://static.tildacdn.com/tild6431-6330-4338-a436-373635616263/_____1.jpg" alt="Quiet workspace with a large window and individual desks" width="1000" height="1000" loading="eager" decoding="async"> <footer class="vf-card-bottom"> <div class="vf-card-heading"> <h3 class="vf-card-title">Parallel</h3> <p class="vf-project-number">05 / Selected work</p> </div> <div class="vf-card-meta"> <p></p> <p></p> </div> </footer> </article> </div> <footer class="vf-bottom-bar"> </footer> </div> </section> <script>
(() => {
const clamp = (value, min = 0, max = 1) =>
Math.min(max, Math.max(min, value));

const mix = (a, b, amount) =>
a + (b - a) * amount;

const ease = value =>
value * value * value * (value * (value * 6 - 15) + 10);

document.querySelectorAll('.vf-projects').forEach(root => {
if (root.vfFolderInitialized) return;
root.vfFolderInitialized = true;

const stage = root.querySelector('.vf-stage');
const scene = root.querySelector('.vf-scene');
const bar = root.querySelector('.vf-progress-fill');
const reducedMotion = window.matchMedia(
'(prefers-reduced-motion: reduce)'
);

const settings = {
introHold: .22,
gather: 1.15,
stackHold: .34,
turn: 1.08,
endHold: .5,
smoothing: 105,
startScaleDesktop: 1.28,
startScaleMobile: 1.16
};

let cards = [];
let geometry = null;
let frame = 0;
let resizeFrame = 0;
let position = 0;
let target = 0;
let lastTime = 0;
let needsRead = true;

function stackPose(rank) {
const scale = Math.pow(.925, rank);

return {
x: 0,
y: -(1 - scale) * geometry.size * .5 - rank * geometry.gap,
scale,
rotateX: 0,
rotateZ: 0
};
}

function blendPose(from, to, amount) {
return {
x: mix(from.x, to.x, amount),
y: mix(from.y, to.y, amount),
scale: mix(from.scale, to.scale, amount),
rotateX: mix(from.rotateX, to.rotateX, amount),
rotateZ: mix(from.rotateZ, to.rotateZ, amount)
};
}

function flightPose(amount) {
const back = stackPose(cards.length - 1);
const split = .46;
const lowPoint = geometry.size * 1.06;

return amount < split
? blendPose(
stackPose(0),
{
x: geometry.size * .045,
y: lowPoint,
scale: 1.035,
rotateX: -9,
rotateZ: 1.5
},
ease(amount / split)
)
: blendPose(
{
x: geometry.size * .045,
y: lowPoint,
scale: 1.035,
rotateX: -9,
rotateZ: 1.5
},
back,
ease((amount - split) / (1 - split))
);
}

function drawCard(card, pose, depth) {
card.style.transform =
`translate(-50%, -50%) ` +
`translate3d(${pose.x.toFixed(3)}px, ${pose.y.toFixed(3)}px, 0) ` +
`rotateX(${pose.rotateX.toFixed(3)}deg) ` +
`rotateZ(${pose.rotateZ.toFixed(3)}deg) ` +
`scale(${pose.scale.toFixed(5)})`;

card.style.zIndex = depth;
}

function render() {
if (!geometry) return;

const count = cards.length;
const gatherProgress = clamp(
(position - settings.introHold) / settings.gather
);

if (position < geometry.turnStart) {
const stagger = Math.min(.24, (count - 1) * .055);

cards.forEach((card, index) => {
const delay = count > 1
? index / (count - 1) * stagger
: 0;

const amount = ease(
clamp((gatherProgress - delay) / (1 - stagger))
);

const initial = {
x: (geometry.initialLead - index) * geometry.stepX,
y: (geometry.initialLead - index) * geometry.stepY,
scale: geometry.initialSize / geometry.size,
rotateX: 0,
rotateZ: 0
};

drawCard(
card,
blendPose(initial, stackPose(index), amount),
count - index
);
});
} else {
const turnPosition = Math.max(
0,
(position - geometry.turnStart) / settings.turn
);

const step = Math.min(count - 1, Math.floor(turnPosition));
const fraction = step < count - 1 ? turnPosition - step : 0;
const flight = clamp((fraction - .12) / .82);
const advance = ease(clamp((flight - .12) / .78));

cards.forEach((card, index) => {
const rank = (index - step + count) % count;

if (rank === 0 && flight > 0) {
drawCard(
card,
flightPose(flight),
flight < .46 ? count + 2 : 1
);
} else {
const pose = rank === 0
? stackPose(0)
: blendPose(
stackPose(rank),
stackPose(rank - 1),
advance
);

drawCard(card, pose, count - rank + 1);
}
});
}

if (bar) {
bar.style.transform =
`scaleX(${clamp(position / geometry.total)})`;
}
}

function readScroll() {
if (!geometry) return;

target = clamp(
-root.getBoundingClientRect().top / geometry.vh,
0,
geometry.total
);

needsRead = false;
}

function tick(time) {
frame = 0;

if (!geometry || !root.isConnected) return;
if (needsRead) readScroll();

const dt = Math.min(
64,
lastTime ? time - lastTime : 16.67
);

lastTime = time;

position += (target - position) *
(1 - Math.exp(-dt / settings.smoothing));

if (Math.abs(target - position) < .00015) {
position = target;
}

render();

if (position !== target) {
frame = requestAnimationFrame(tick);
} else {
lastTime = 0;
}
}

function requestTick() {
if (!geometry) return;

needsRead = true;

if (!frame) {
frame = requestAnimationFrame(tick);
}
}

function measure() {
resizeFrame = 0;

cards = Array.from(scene.children).filter(
card => card.matches('.vf-card')
);

if (reducedMotion.matches || !cards.length) {
geometry = null;
root.classList.remove('vf-ready');
root.style.removeProperty('height');

cards.forEach(card => {
card.style.removeProperty('transform');
card.style.removeProperty('z-index');
});

return;
}

const previousVh = geometry ? geometry.vh : 0;

root.classList.add('vf-ready');

const vh = stage.clientHeight || window.innerHeight;
const turnStart =
settings.introHold + settings.gather + settings.stackHold;

const total =
turnStart + (cards.length - 1) * settings.turn + settings.endHold;

root.style.height = `${vh * (1 + total)}px`;

const bounds = scene.getBoundingClientRect();
const narrow = bounds.width < 600;

const size = Math.max(
1,
Math.min(
560,
bounds.width * (narrow ? .9 : .68),
bounds.height * .78
)
);

const dx = narrow ? .42 : .62;
const dy = narrow ? .6 : .5;

const initialSize = size * (
narrow
? settings.startScaleMobile
: settings.startScaleDesktop
);

const initialLead = Math.min(
(cards.length - 1) * .5,
1.35
);

geometry = {
vh,
size,
total,
turnStart,
initialSize,
initialLead,
width: root.clientWidth,
stepX: initialSize * dx,
stepY: initialSize * dy,
gap: Math.min(
size * .041,
(bounds.height - size) * .44 / Math.max(1, cards.length - 1)
)
};

root.style.setProperty('--vf-size', `${size}px`);

readScroll();

position = previousVh
? clamp(position * previousVh / vh, 0, total)
: target;

render();
requestTick();
}

function requestMeasure() {
if (!resizeFrame) {
resizeFrame = requestAnimationFrame(measure);
}
}

window.addEventListener('scroll', requestTick, { passive: true });
window.addEventListener('resize', requestMeasure, { passive: true });
window.addEventListener('pageshow', requestMeasure);
reducedMotion.addEventListener('change', requestMeasure);

if (window.ResizeObserver) {
new ResizeObserver(() => {
if (
!geometry ||
Math.abs(root.clientWidth - geometry.width) > 1
) {
requestMeasure();
}
}).observe(root);
}

new MutationObserver(requestMeasure).observe(
scene,
{ childList: true }
);

measure();
});
})();
</script>
Скопировать код
Что выбрать, промпт или код?
Копируйте промпт, если хотите получить похожий результат, но ввести информацию о своём бизнесе и задать свои требования. Например, изменить кнопки, тексты, цвета, фотографии или другие элементы.
Копируйте код, если хотите получить точно такой же блок. Чтобы его изменить, придётся отредактировать html-код.
Начните создание сайта на Тильде с простой регистрации на платформе
Made on
Tilda