Initial commit of project structure
This commit is contained in:
BIN
product-scroll-poc/cup.png
Normal file
BIN
product-scroll-poc/cup.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 MiB |
BIN
product-scroll-poc/cup_spin.mp4
Normal file
BIN
product-scroll-poc/cup_spin.mp4
Normal file
Binary file not shown.
96
product-scroll-poc/index.html
Normal file
96
product-scroll-poc/index.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>HOTCHPOTSH — The Art of the Spin</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,200,0,0" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="prototype-header">
|
||||
<div class="logo">HOTCHPOTSH</div>
|
||||
<div class="nav-minimal">Prototype 02 / Product Spin</div>
|
||||
</header>
|
||||
|
||||
<div class="scroll-container">
|
||||
|
||||
<!-- Intro Section -->
|
||||
<section class="intro-section">
|
||||
<div class="intro-content">
|
||||
<span class="label">Excellence in Form</span>
|
||||
<h1>Tracing the Hand of the Maker</h1>
|
||||
<p>A study of rotation, material, and light. Scroll to explore the silhouette of our signature Stoneware Mug.</p>
|
||||
<div class="scroll-indicator">
|
||||
<span class="material-symbols-outlined animate-bounce">expand_more</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Sticky Product Wrapper -->
|
||||
<div class="product-stage">
|
||||
<div class="cup-wrapper">
|
||||
<!-- Canvas for smooth image sequence -->
|
||||
<canvas id="cup-canvas"></canvas>
|
||||
<!-- Hidden video for source buffering -->
|
||||
<video id="cup-video" src="cup_spin.mp4" playsinline muted preload="auto" style="display: none;"></video>
|
||||
<div class="stage-overlay"></div>
|
||||
|
||||
<!-- Buffering Status -->
|
||||
<div id="buffer-status" class="buffer-info">
|
||||
<span class="loader-dots"></span>
|
||||
<span class="status-text">Refining silhouette...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scrolling Text Sections -->
|
||||
<div class="content-section" data-step="1">
|
||||
<div class="text-block">
|
||||
<span class="step-num">01</span>
|
||||
<h2>The Form</h2>
|
||||
<p>Hand-thrown on the wheel, embracing imperfect symmetry. Every curve is a witness to the tactile dialogue between hands and clay.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-section" data-step="2">
|
||||
<div class="text-block">
|
||||
<span class="step-num">02</span>
|
||||
<h2>The Clay</h2>
|
||||
<p>Locally sourced stoneware, rich in texture and history. We use a high-iron body that produces subtle speckling during the long firing process.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-section" data-step="3">
|
||||
<div class="text-block">
|
||||
<span class="step-num">03</span>
|
||||
<h2>The Glaze</h2>
|
||||
<p>Fired at 1200°C to achieve a unique, stone-like finish. Our satin-matte glaze is applied by dipping, creating natural variations in depth.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-section" data-step="4">
|
||||
<div class="text-block">
|
||||
<span class="step-num">04</span>
|
||||
<h2>Daily Ritual</h2>
|
||||
<p>Designed to be held, used, and cherished every morning. A vessel not just for coffee, but for a moment of quiet reflection.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Section -->
|
||||
<section class="outro-section">
|
||||
<div class="outro-content">
|
||||
<h2>Limited Release</h2>
|
||||
<p>The Studio Collection / Batch 014</p>
|
||||
<button class="btn-minimal">Shop Collection</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
24
product-scroll-poc/remove_bg.py
Normal file
24
product-scroll-poc/remove_bg.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
|
||||
def remove_white_background(input_path, output_path, threshold=240):
|
||||
img = Image.open(input_path).convert("RGBA")
|
||||
data = np.array(img)
|
||||
|
||||
# RGB values
|
||||
r, g, b, a = data.T
|
||||
|
||||
# Define white areas (pixels > threshold)
|
||||
white_areas = (r > threshold) & (g > threshold) & (b > threshold)
|
||||
|
||||
# Set alpha to 0 for white areas
|
||||
data[..., 3][white_areas.T] = 0
|
||||
|
||||
# Create new image
|
||||
new_img = Image.fromarray(data)
|
||||
new_img.save(output_path)
|
||||
print(f"Saved transparent image to {output_path}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Use relative paths so it works in WSL/Linux too
|
||||
remove_white_background("cup.png", "cup_transparent.png")
|
||||
137
product-scroll-poc/script.js
Normal file
137
product-scroll-poc/script.js
Normal file
@@ -0,0 +1,137 @@
|
||||
gsap.registerPlugin(ScrollTrigger);
|
||||
|
||||
const canvas = document.querySelector("#cup-canvas");
|
||||
const context = canvas.getContext("2d");
|
||||
const video = document.querySelector("#cup-video");
|
||||
const status = document.querySelector("#buffer-status");
|
||||
|
||||
const frames = [];
|
||||
let isBuffered = false;
|
||||
|
||||
// 1. Canvas Setup
|
||||
function resizeCanvas() {
|
||||
if (video.videoWidth) {
|
||||
canvas.width = video.videoWidth;
|
||||
canvas.height = video.videoHeight;
|
||||
} else {
|
||||
canvas.width = 1000;
|
||||
canvas.height = 1000;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Buffering Logic (Capturing frames into memory)
|
||||
video.addEventListener("loadedmetadata", () => {
|
||||
resizeCanvas();
|
||||
startBuffering();
|
||||
});
|
||||
|
||||
async function startBuffering() {
|
||||
video.currentTime = 0;
|
||||
video.playbackRate = 1; // Standard speed for better capture quality
|
||||
await video.play();
|
||||
|
||||
function capture() {
|
||||
if (video.paused || video.ended) {
|
||||
finishBuffering();
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw video frame to worker canvas and store as ImageBitmap
|
||||
createImageBitmap(video).then(bitmap => {
|
||||
frames.push(bitmap);
|
||||
|
||||
// Draw first frame immediately
|
||||
if (frames.length === 1) renderFrame(0);
|
||||
|
||||
requestAnimationFrame(capture);
|
||||
});
|
||||
}
|
||||
|
||||
requestAnimationFrame(capture);
|
||||
}
|
||||
|
||||
function finishBuffering() {
|
||||
isBuffered = true;
|
||||
status.style.opacity = "0";
|
||||
video.pause();
|
||||
initScrollAnimation();
|
||||
}
|
||||
|
||||
function renderFrame(index) {
|
||||
if (!frames[index]) return;
|
||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
context.drawImage(frames[index], 0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
// 3. Optimized Scroll Animation
|
||||
function initScrollAnimation() {
|
||||
const totalFrames = frames.length - 1;
|
||||
const scrollObj = { frame: 0 };
|
||||
|
||||
// GSAP Timeline for the whole experience
|
||||
const tl = gsap.timeline({
|
||||
scrollTrigger: {
|
||||
trigger: ".scroll-container",
|
||||
start: "top top",
|
||||
end: "bottom bottom",
|
||||
scrub: 0.5, // Slight lag-behind for smoothness
|
||||
}
|
||||
});
|
||||
|
||||
// Frame scrubbing
|
||||
tl.to(scrollObj, {
|
||||
frame: totalFrames,
|
||||
ease: "none",
|
||||
onUpdate: () => renderFrame(Math.floor(scrollObj.frame))
|
||||
}, 0);
|
||||
|
||||
// Intro Fade
|
||||
gsap.to(".intro-content", {
|
||||
opacity: 0,
|
||||
y: -50,
|
||||
scrollTrigger: {
|
||||
trigger: ".intro-section",
|
||||
start: "top top",
|
||||
end: "bottom center",
|
||||
scrub: true
|
||||
}
|
||||
});
|
||||
|
||||
// Sub-animations for depth
|
||||
tl.to(canvas, {
|
||||
scale: 0.95,
|
||||
rotateY: 5,
|
||||
ease: "sine.inOut"
|
||||
}, 0);
|
||||
|
||||
// Content text reveal
|
||||
const sections = document.querySelectorAll(".content-section");
|
||||
sections.forEach((section) => {
|
||||
const text = section.querySelector(".text-block");
|
||||
gsap.fromTo(text,
|
||||
{ opacity: 0, y: 40 },
|
||||
{
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
duration: 1,
|
||||
scrollTrigger: {
|
||||
trigger: section,
|
||||
start: "top 70%",
|
||||
end: "top 30%",
|
||||
toggleActions: "play reverse play reverse",
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Exit
|
||||
gsap.to(".product-stage", {
|
||||
opacity: 0,
|
||||
scrollTrigger: {
|
||||
trigger: ".outro-section",
|
||||
start: "top center",
|
||||
end: "bottom bottom",
|
||||
scrub: true
|
||||
}
|
||||
});
|
||||
}
|
||||
334
product-scroll-poc/style.css
Normal file
334
product-scroll-poc/style.css
Normal file
@@ -0,0 +1,334 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;1,400&family=Inter:wght@300;400;500&family=JetBrains+Mono:wght@300&display=swap');
|
||||
|
||||
:root {
|
||||
--bg-color: #f8f6f3;
|
||||
--text-color: #1c1917;
|
||||
--accent-color: #44403c;
|
||||
--muted-color: #a8a29e;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
font-family: 'Inter', sans-serif;
|
||||
overflow-x: hidden;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Optional: Grain Texture Overlay for that premium tactile feel */
|
||||
body::after {
|
||||
content: "";
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url("https://grainy-gradients.vercel.app/noise.svg");
|
||||
opacity: 0.04;
|
||||
pointer-events: none;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.prototype-header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 3rem 4rem;
|
||||
/* More air */
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
z-index: 100;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.3em;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-weight: 500;
|
||||
border-bottom: 1px solid var(--text-color);
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
/* Scroll Container */
|
||||
.scroll-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Sections */
|
||||
section {
|
||||
position: relative;
|
||||
height: 120vh;
|
||||
/* More scroll space */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 4rem;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/* Intro */
|
||||
.intro-content {
|
||||
text-align: center;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.intro-content .label {
|
||||
display: block;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.6em;
|
||||
color: var(--muted-color);
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.intro-content h1 {
|
||||
font-family: 'Playfair Display', serif;
|
||||
font-size: 6rem;
|
||||
font-weight: 400;
|
||||
margin-bottom: 3rem;
|
||||
line-height: 1.05;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.intro-content p {
|
||||
font-size: 1.1rem;
|
||||
color: var(--accent-color);
|
||||
line-height: 1.8;
|
||||
max-width: 500px;
|
||||
margin: 0 auto 4rem;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.scroll-indicator {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Sticky Product Stage */
|
||||
.product-stage {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
perspective: 1500px;
|
||||
}
|
||||
|
||||
.cup-wrapper {
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#cup-canvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
filter: drop-shadow(0 40px 80px rgba(0, 0, 0, 0.08));
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.buffer-info {
|
||||
position: absolute;
|
||||
bottom: -40px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.6rem;
|
||||
color: var(--muted-color);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.2em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
transition: opacity 0.5s ease;
|
||||
}
|
||||
|
||||
.loader-dots::after {
|
||||
content: " .";
|
||||
animation: dots 1.5s steps(5, end) infinite;
|
||||
}
|
||||
|
||||
@keyframes dots {
|
||||
20% {
|
||||
content: " .";
|
||||
}
|
||||
|
||||
40% {
|
||||
content: " ..";
|
||||
}
|
||||
|
||||
60% {
|
||||
content: " ...";
|
||||
}
|
||||
|
||||
80% {
|
||||
content: " ....";
|
||||
}
|
||||
}
|
||||
|
||||
.cup-video {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.stage-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: radial-gradient(circle at center, transparent 30%, var(--bg-color) 70%);
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
/* Content Sections */
|
||||
.content-section {
|
||||
position: relative;
|
||||
height: 150vh;
|
||||
/* Slow down the scroll feel */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 12%;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.content-section:nth-child(odd) {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.content-section:nth-child(even) {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.text-block {
|
||||
max-width: 450px;
|
||||
opacity: 1;
|
||||
/* Handled by GSAP now */
|
||||
}
|
||||
|
||||
.step-num {
|
||||
display: block;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted-color);
|
||||
margin-bottom: 2rem;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.step-num::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 40px;
|
||||
top: 50%;
|
||||
width: 60px;
|
||||
height: 1px;
|
||||
background: var(--muted-color);
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.text-block h2 {
|
||||
font-family: 'Playfair Display', serif;
|
||||
font-size: 4.5rem;
|
||||
font-weight: 400;
|
||||
margin-bottom: 2.5rem;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.text-block p {
|
||||
font-size: 1.05rem;
|
||||
line-height: 2;
|
||||
color: var(--accent-color);
|
||||
font-weight: 300;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
/* Outro */
|
||||
.outro-content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.outro-content h2 {
|
||||
font-family: 'Playfair Display', serif;
|
||||
font-size: 4rem;
|
||||
font-weight: 400;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.btn-minimal {
|
||||
margin-top: 3rem;
|
||||
padding: 1rem 3rem;
|
||||
border: 1px solid var(--text-color);
|
||||
background: transparent;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.2em;
|
||||
cursor: pointer;
|
||||
transition: all 0.4s ease;
|
||||
}
|
||||
|
||||
.btn-minimal:hover {
|
||||
background: var(--text-color);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
.animate-bounce {
|
||||
animation: bounce 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes bounce {
|
||||
|
||||
0%,
|
||||
20%,
|
||||
50%,
|
||||
80%,
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
40% {
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
|
||||
60% {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.intro-content h1 {
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.cup-wrapper {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.text-block h2 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.prototype-header {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user