feat: IMAP mail sync with thread-to-contact matching (PRD §6.1)
Real IMAP connection via imapflow library: - Connects to IMAP server (IMAPFlow, TLS on port 993) - Fetches recent messages (configurable limit, default 20) - Extracts: from, fromEmail, subject, date, snippet (200 chars) - Thread-to-contact matching (PRD §6.1): 1. Match sender email against persons table 2. If no person match, extract domain and match against company.website 3. Returns matchedCompany + matchedPerson for each email - Audit-logged (action: crm.mailsync:imap) - Zod validated (host, port, user, password, folder, limit) - 502 on IMAP connection failure with detail - 400 on validation failure Tested: invalid creds → 502 'IMAP connection failed', missing host → 400
This commit is contained in:
1 parent
7acc0c5451
commit
e45b68bb8b
1089 files changed
+260614
No files matched your search
+197
@@ -0,0 +1,197 @@
|
||||
---
|
||||
name: video-shortform
|
||||
description: Pro-camera HUD mockup template — full-viewport black canvas wrapping a real video with monospace overlays (corner brackets, top status bar, side AF/exposure columns, bottom timecode + aperture/shutter/ISO row, vertical 8-filter wheel, animated reticle). For cinematographer portfolios, camera-app demos, LUT pack previews, filter-look auditions. NOT a TikTok/Reels mockup, NOT a storyboard, NOT a shot list, NOT a script document. The chrome wraps real footage — never a div placeholder.
|
||||
visibility: public
|
||||
mode: template
|
||||
carrier: web-page
|
||||
scenario: video-showcase
|
||||
pattern_source: video-shortform.html
|
||||
source_priority: skill-first
|
||||
triggers:
|
||||
- "做个相机 HUD mockup"
|
||||
- "包视频的相机取景框"
|
||||
- "LUT 预览页"
|
||||
- "cinematographer 作品包装"
|
||||
- "滤镜审片页"
|
||||
---
|
||||
|
||||
# Video Shortform Template
|
||||
|
||||
Camera-HUD mockup that **wraps a real piece of footage** with pro-camera (RED / ARRI / Blackmagic / Sony Cine-flavored) viewfinder chrome and lets the user audition 8 film-emulation looks against it.
|
||||
|
||||
This template is **not** a TikTok / Reels / 视频号 / 抖音 social mockup, **not** a storyboard, **not** a shot list, **not** a 分镜 / 脚本 document, **not** a vertical-video ad poster.
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ Three Pre-flight Gates — clear all three BEFORE writing code
|
||||
|
||||
### Gate 1 — Is this actually a HUD job, or a script/storyboard job?
|
||||
|
||||
Trigger words that mean **this skill is wrong** and you should refuse:
|
||||
|
||||
| User says | What they actually want | Correct response |
|
||||
|---|---|---|
|
||||
| 短视频脚本 / 视频脚本 / script doc | shot-by-shot text with VO / timing | refuse, suggest a doc template or `wireframe-sketch` |
|
||||
| 分镜 / storyboard / shot list | frame-by-frame thumbnails + descriptions | refuse, suggest a storyboard layout |
|
||||
| 短视频封面 / 视频封面 / video cover | static image / social card | refuse, suggest `social-card-*` skills |
|
||||
| 视频号/抖音/小红书视频卡 | feed-style mockup with profile/likes/comments | refuse, suggest a social card |
|
||||
| 视频海报 / video poster | static print-style poster | refuse, suggest `social-card-image-led` |
|
||||
| 调色 demo / LUT 预览 / 滤镜对比 / cinematographer portfolio / camera-app demo / 拍摄取景器 / viewfinder | ✅ this is the right skill | proceed |
|
||||
|
||||
If the user's words straddle "脚本 / 拍摄 HUD" ambiguity, **stop and ask**:
|
||||
> "你要的是 (a) 拍摄取景器 HUD wrap 一段真视频做调色/镜头展示,还是 (b) 视频脚本/分镜的文档?这个 skill 只做 (a),(b) 我会换别的 skill 来做。"
|
||||
|
||||
Don't guess. Wrong skill = full rewrite.
|
||||
|
||||
### Gate 2 — Where is the video coming from?
|
||||
|
||||
**The chrome wraps a real `<video>`. A `<div>` with `[视频画面]` text inside is not acceptable** — that's what B48 did and the whole point of this template was lost.
|
||||
|
||||
Decision tree:
|
||||
|
||||
1. **User gave a video file / URL** → use it directly in `<video src="...">`
|
||||
2. **User gave nothing but is OK with sample footage** → pick ONE from the Hotlink List below, paste the URL into `<video src>`, add a one-liner "示例素材:Big Buck Bunny / 公共测试视频,替换为自己的素材后效果一致"
|
||||
3. **User wants offline / self-contained** → `curl -L -o sample.mp4 <hotlink>` into the case folder, then `<video src="sample.mp4">`
|
||||
4. **Unclear** → stop and ask which of 1/2/3 they want
|
||||
|
||||
#### Hotlink List (public sample footage, verified 200 OK as of 2026-06)
|
||||
|
||||
Pick in this priority order. The historical "Google Cloud gtv-videos-bucket" URLs are **dead** (anonymous access revoked) — don't use them even though they're widely cited online.
|
||||
|
||||
```
|
||||
# Mozilla MDN — most reliable, CORS-friendly, h264
|
||||
https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4 # ~30s, 16:9, CC0 flower close-up
|
||||
|
||||
# test-videos.co.uk — purpose-built test files, multiple sizes
|
||||
https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/720/Big_Buck_Bunny_720_10s_1MB.mp4 # 10s, 720p, ~1MB
|
||||
https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4 # 10s, 360p, ~1MB tiny fallback
|
||||
|
||||
# w3.org — cinematic trailers, longer playback
|
||||
https://media.w3.org/2010/05/sintel/trailer.mp4 # Sintel trailer, ~52s, cinematic 16:9
|
||||
|
||||
# W3Schools — well-known, oldest standby
|
||||
https://www.w3schools.com/html/mov_bbb.mp4 # ~10s BBB clip, h264
|
||||
https://www.w3schools.com/html/movie.mp4 # generic test clip
|
||||
```
|
||||
|
||||
If you need to verify before using: `curl -sIL -o /dev/null -w "%{http_code} %{content_type}\n" <url>` — expect `200 video/mp4`. If a URL returns 403 / 404 / 000, fall to the next in the list. Don't ship a dead URL.
|
||||
|
||||
**Required `<video>` attributes** (or autoplay won't fire on most browsers):
|
||||
|
||||
```html
|
||||
<video src="<hotlink-or-local>"
|
||||
autoplay muted loop playsinline
|
||||
preload="auto"
|
||||
style="width:100%;height:100%;object-fit:cover">
|
||||
</video>
|
||||
```
|
||||
|
||||
`muted` is mandatory for autoplay on Chrome/Safari/Mobile. `playsinline` is mandatory for iOS not to take the video fullscreen.
|
||||
|
||||
### Gate 3 — What's in the filter wheel?
|
||||
|
||||
8 filters is the canonical count (reference uses 8). For each, declare:
|
||||
- Display name (3–6 chars, e.g. `KODAK 2383`, `FUJI 3510`, `LOG`, `REC 709`)
|
||||
- CSS filter recipe to apply to the video: `filter: contrast(1.1) saturate(.85) sepia(.15) hue-rotate(-5deg) ...`
|
||||
- Optionally: corresponding camera-setting deltas (F-stop / shutter / ISO / EV) that update in the HUD when the filter is active
|
||||
|
||||
If user didn't specify, default to these 8 (covers the common LUT palette space):
|
||||
|
||||
```
|
||||
01 LOG filter: contrast(.85) saturate(.7) brightness(1.05);
|
||||
02 REC 709 filter: none; /* baseline */
|
||||
03 KODAK 2383 filter: contrast(1.1) saturate(.9) sepia(.08) hue-rotate(-4deg);
|
||||
04 FUJI 3510 filter: contrast(1.05) saturate(1.1) hue-rotate(8deg);
|
||||
05 ARRI K1S1 filter: contrast(1.15) saturate(.85) brightness(.95);
|
||||
06 TEAL ORANGE filter: contrast(1.2) saturate(1.2) hue-rotate(-12deg);
|
||||
07 B&W filter: grayscale(1) contrast(1.15);
|
||||
08 BLEACH BP filter: saturate(.3) contrast(1.25) brightness(1.05);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Must-Have HUD Interactions — none of these are optional
|
||||
|
||||
If any is missing, the artifact is incomplete. **B48 was missing all 6**.
|
||||
|
||||
1. **Real `<video>` element** (Gate 2 enforces). Not a div, not a poster image, not a bg image.
|
||||
2. **Filter wheel switching** — scroll wheel + ArrowUp/ArrowDown + click each dot cycles through the 8 filters; active filter highlighted in record-red.
|
||||
3. **Timecode running at 24/25 fps** — `HH:MM:SS:FF` format, `requestAnimationFrame`-driven, tabular-nums, restarts with the video loop.
|
||||
4. **Reticle pulse** — slow scale + opacity loop, accent stroke (record-red **not green**), animation paused under `prefers-reduced-motion`.
|
||||
5. **Filter-switch brightness flash** — 80–120 ms white flash over the video on filter change (simulates exposure re-meter); skip if `prefers-reduced-motion`.
|
||||
6. **Battery drain** — top-right battery readout decreases 1% every 8–12s, stops at 5%, turns red ≤ 20%.
|
||||
|
||||
Optional but encouraged: REC pulse (red dot blinks at 1Hz when "recording"), focus-confirm beep when filter changes, histogram glyph in a corner.
|
||||
|
||||
---
|
||||
|
||||
## Must-Lock Visual Rules — no substitutions
|
||||
|
||||
| Lock | Value | Why |
|
||||
|---|---|---|
|
||||
| Background | pure `#000` | Not `#0a0a0a`, not a dark gray. Black canvas is the viewfinder. |
|
||||
| Foreground type | `#e0e0e0` / `#fff` | One light tone only. |
|
||||
| Single accent | **record-red `#ff3b30`** | Used for REC pill, active filter, reticle, warning states. **Not green, not blue, not teal** — record-red is the entire visual signature of this template. |
|
||||
| Type stack | mono only (`SF Mono` / `JetBrains Mono` / `Menlo` / `IBM Plex Mono`) | No sans for HUD numerics. CJK script-overlay is the only sans use, and that overlay is itself rare. |
|
||||
| HUD opacity | secondary readouts ≈ 45% | Video stays protagonist. |
|
||||
| Border style | 4 corner brackets, never solid border | Solid border = monitor frame, not viewfinder. |
|
||||
| Filter wheel | vertical, ~8 dots, right side | Horizontal carousel = social UI, wrong register. |
|
||||
|
||||
---
|
||||
|
||||
## Anti-patterns (self-check against B48's failure modes)
|
||||
|
||||
- [ ] `<video>` is missing or replaced with `<div>` + text → reject, go back to Gate 2
|
||||
- [ ] Accent color is anything other than `#ff3b30` (e.g. green, teal, blue) → revert
|
||||
- [ ] HUD numerics are static strings (timecode, ISO, battery) → make them live
|
||||
- [ ] Filter wheel has no interaction (no scroll/arrow/click handler) → wire it up
|
||||
- [ ] Script / 镜头 / VO / 旁白 text block layered on top → wrong skill, refuse the job at Gate 1
|
||||
- [ ] Social UI (profile, likes, captions, music attribution) → wrong skill, refuse
|
||||
- [ ] Centered Play/Pause button → this is a viewfinder, kill it
|
||||
- [ ] More than one accent color → revert to record-red only
|
||||
- [ ] Glassmorphism / gradient / glow shadow on HUD elements → camera chrome is flat, kill it
|
||||
- [ ] Sans-serif on HUD readouts → switch to mono
|
||||
- [ ] Yellow / amber / cyan HUD tint to "look futuristic" → flat white/gray + record-red only
|
||||
- [ ] No `muted playsinline autoplay loop` on `<video>` → won't autoplay, add them
|
||||
|
||||
---
|
||||
|
||||
## Required Reading
|
||||
|
||||
Read this `SKILL.md` first, end to end. Then read `video-shortform.html` for the actual implementation patterns: corner-bracket geometry, the timecode HH:MM:SS:FF ticker logic, the 8-filter wheel scroll/keyboard handlers, the reticle pulse keyframes, the battery drain interval, and the filter-switch brightness flash.
|
||||
|
||||
Do not copy:
|
||||
- the fallback video URLs from the reference (use the Hotlink List above)
|
||||
- the placeholder filter metadata (use Gate 3's defaults or the user's spec)
|
||||
- class names wholesale (rename for the project)
|
||||
|
||||
---
|
||||
|
||||
## Design Strategy
|
||||
|
||||
Lock the experience contract before writing:
|
||||
|
||||
1. **Source video** (Gate 2) — what footage, what aspect ratio, how long?
|
||||
2. **Filter set** (Gate 3) — names + CSS filter recipes for all 8
|
||||
3. **HUD honesty** — which numbers react to filter change, which are decorative?
|
||||
4. **Aspect** — 16:9 desktop default; if vertical 9:16, the side columns crowd, switch to top/bottom-only HUD strips
|
||||
|
||||
---
|
||||
|
||||
## Layout Bias
|
||||
|
||||
Prefer:
|
||||
- pure black canvas; mono only; record-red accent
|
||||
- 4 corner brackets at 24–32 px from video edges
|
||||
- secondary HUD at ~45% opacity so footage dominates
|
||||
- vertical 8-filter wheel right side, ~20 px dots
|
||||
- subtle film-grain `::after` overlay (5–8% opacity max, multiply blend)
|
||||
- timecode bottom-center, tabular-nums, bigger than other HUD elements
|
||||
|
||||
Avoid: everything in the Must-Lock and Anti-patterns tables above.
|
||||
|
||||
---
|
||||
|
||||
## Platform / Size
|
||||
|
||||
Full-viewport, responsive to window aspect. Best on desktop with a 16:9 source. Portrait video works but side columns crowd — move HUD strips to top/bottom. Mobile renders but keyboard cycling is lost — add touch swipe up/down on the filter wheel.
|
||||
@@ -0,0 +1,743 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Video Showform — Viewfinder</title>
|
||||
<style>
|
||||
:root {
|
||||
--hud: #ffffff;
|
||||
--hud-dim: rgba(255,255,255,0.45);
|
||||
--hud-line: rgba(255,255,255,0.2);
|
||||
--rec: #ff3b30;
|
||||
--mono: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
|
||||
}
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; }
|
||||
body {
|
||||
font-family: var(--mono);
|
||||
color: var(--hud);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.viewfinder {
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ---------- 视频舞台 ---------- */
|
||||
.stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1;
|
||||
}
|
||||
.video-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
transition: transform 0.6s cubic-bezier(.2,.8,.2,1),
|
||||
-webkit-mask-image 0.6s ease,
|
||||
mask-image 0.6s ease;
|
||||
}
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
transition: filter 0.5s ease;
|
||||
background: #0a0a0a;
|
||||
}
|
||||
|
||||
/* ---------- 滤镜 ---------- */
|
||||
.f-original { filter: contrast(1.02) brightness(1.0); }
|
||||
.f-vivid { filter: saturate(1.6) contrast(1.15) brightness(1.05); }
|
||||
.f-vintage { filter: sepia(0.55) contrast(0.92) brightness(0.96) saturate(0.7) hue-rotate(-10deg); }
|
||||
.f-fuji { filter: contrast(1.1) saturate(1.2) brightness(1.05) hue-rotate(-5deg); }
|
||||
.f-mono { filter: grayscale(1) contrast(1.2) brightness(0.98); }
|
||||
.f-cold { filter: hue-rotate(180deg) saturate(1.3) brightness(0.95); }
|
||||
.f-cinema { filter: contrast(1.2) saturate(0.8) brightness(0.9); }
|
||||
.fisheye .video-wrap {
|
||||
-webkit-mask-image: radial-gradient(circle at center, #000 56%, transparent 72%);
|
||||
mask-image: radial-gradient(circle at center, #000 56%, transparent 72%);
|
||||
transform: scale(1.06);
|
||||
}
|
||||
.fisheye video { filter: contrast(1.1) saturate(1.15); transform: scale(1.15); }
|
||||
|
||||
.flash { animation: flash 0.32s ease; }
|
||||
@keyframes flash { 0% { opacity: 1; } 35% { opacity: 0.35; } 100% { opacity: 1; } }
|
||||
|
||||
.grain {
|
||||
position: absolute; inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 4;
|
||||
background: repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
|
||||
mix-blend-mode: overlay;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* ---------- HUD ---------- */
|
||||
.hud {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 5;
|
||||
color: var(--hud);
|
||||
text-shadow: 0 0 6px rgba(0,0,0,0.6);
|
||||
}
|
||||
.hud-pad { position: absolute; inset: 28px 32px; }
|
||||
|
||||
.frame-corner {
|
||||
position: absolute;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border: 1.5px solid var(--hud);
|
||||
}
|
||||
.fc-tl { top: 0; left: 0; border-right: none; border-bottom: none; }
|
||||
.fc-tr { top: 0; right: 0; border-left: none; border-bottom: none; }
|
||||
.fc-bl { bottom: 0; left: 0; border-right: none; border-top: none; }
|
||||
.fc-br { bottom: 0; right: 0; border-left: none; border-top: none; }
|
||||
|
||||
.top-row {
|
||||
position: absolute;
|
||||
top: 6px; left: 80px; right: 80px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
.top-left, .top-right { display: flex; align-items: center; gap: 14px; }
|
||||
.badge {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
padding: 1px 8px;
|
||||
border: 1.5px solid var(--hud);
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.06em;
|
||||
min-width: 28px; height: 20px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.badge-a { width: 28px; height: 24px; font-weight: 600; font-size: 15px; }
|
||||
.rec-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: transparent;
|
||||
border: 1.5px solid var(--hud);
|
||||
color: var(--hud);
|
||||
padding: 2px 9px 2px 7px;
|
||||
font-family: var(--mono);
|
||||
font-size: 13px;
|
||||
letter-spacing: 0.06em;
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
pointer-events: auto;
|
||||
height: 22px;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
.rec-btn:hover { background: rgba(255,255,255,0.12); }
|
||||
.rec-btn:active { transform: scale(0.96); }
|
||||
.rec-dot {
|
||||
width: 10px; height: 10px;
|
||||
background: var(--rec);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 8px rgba(255,59,48,0.7);
|
||||
animation: blink 1.1s steps(2, end) infinite;
|
||||
}
|
||||
.rec-btn.paused .rec-dot {
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
animation: none;
|
||||
width: 8px; height: 10px;
|
||||
border-left: 2px solid var(--hud);
|
||||
border-right: 2px solid var(--hud);
|
||||
border-radius: 0;
|
||||
}
|
||||
@keyframes blink { 50% { opacity: 0.15; } }
|
||||
|
||||
.battery {
|
||||
position: relative;
|
||||
width: 34px; height: 16px;
|
||||
border: 1.5px solid var(--hud);
|
||||
padding: 1.5px;
|
||||
border-radius: 1px;
|
||||
}
|
||||
.battery::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -4px; top: 4px;
|
||||
width: 2px; height: 6px;
|
||||
background: var(--hud);
|
||||
}
|
||||
.battery span { display: block; height: 100%; background: var(--hud); width: 100%; }
|
||||
|
||||
.side-col {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 22px;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.04em;
|
||||
align-items: center;
|
||||
}
|
||||
.side-left { left: -4px; }
|
||||
.side-right { right: -4px; align-items: flex-end; }
|
||||
|
||||
.icon-box { display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1; }
|
||||
.icon {
|
||||
width: 22px; height: 22px;
|
||||
border: 1.5px solid var(--hud);
|
||||
border-radius: 2px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.icon svg { width: 14px; height: 14px; stroke: var(--hud); fill: none; stroke-width: 1.5; }
|
||||
|
||||
.bottom-row {
|
||||
position: absolute;
|
||||
bottom: 6px; left: 80px; right: 80px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
font-size: 14px;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
.bottom-left, .bottom-right { display: flex; align-items: center; gap: 16px; }
|
||||
.timecode {
|
||||
font-size: 18px;
|
||||
letter-spacing: 0.12em;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.micro {
|
||||
font-size: 11px;
|
||||
color: var(--hud-dim);
|
||||
margin-top: 4px;
|
||||
letter-spacing: 0.15em;
|
||||
}
|
||||
.stack { display: flex; flex-direction: column; align-items: center; gap: 2px; }
|
||||
|
||||
/* 中央对焦框 */
|
||||
.reticle {
|
||||
position: absolute;
|
||||
top: 50%; left: 50%;
|
||||
width: 78px; height: 78px;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.reticle .c { position: absolute; width: 16px; height: 16px; border: 1.5px solid var(--hud); }
|
||||
.reticle .c1 { top: 0; left: 0; border-right: none; border-bottom: none; }
|
||||
.reticle .c2 { top: 0; right: 0; border-left: none; border-bottom: none; }
|
||||
.reticle .c3 { bottom: 0; left: 0; border-right: none; border-top: none; }
|
||||
.reticle .c4 { bottom: 0; right: 0; border-left: none; border-top: none; }
|
||||
.reticle .dot {
|
||||
position: absolute;
|
||||
top: 50%; left: 50%;
|
||||
width: 4px; height: 4px;
|
||||
background: var(--hud);
|
||||
border-radius: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.reticle.focus { animation: focus 0.5s ease; }
|
||||
@keyframes focus {
|
||||
0% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.4; }
|
||||
100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
|
||||
}
|
||||
|
||||
/* ---------- 滤镜纵向选择器(底部中央) ---------- */
|
||||
.filter-wheel {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 88px;
|
||||
transform: translateX(-50%);
|
||||
width: 280px;
|
||||
height: 168px; /* 显示 5 项,每项 ~36px */
|
||||
z-index: 7;
|
||||
pointer-events: auto;
|
||||
overflow: hidden;
|
||||
-webkit-mask-image: linear-gradient(to bottom,
|
||||
transparent 0%,
|
||||
#000 25%,
|
||||
#000 75%,
|
||||
transparent 100%);
|
||||
mask-image: linear-gradient(to bottom,
|
||||
transparent 0%,
|
||||
#000 25%,
|
||||
#000 75%,
|
||||
transparent 100%);
|
||||
}
|
||||
.filter-list {
|
||||
position: absolute;
|
||||
left: 0; right: 0;
|
||||
top: 50%;
|
||||
transition: transform 0.4s cubic-bezier(.22,.85,.25,1.05);
|
||||
will-change: transform;
|
||||
}
|
||||
.filter-item {
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
color: var(--hud-dim);
|
||||
cursor: pointer;
|
||||
font-family: var(--mono);
|
||||
font-size: 14px;
|
||||
letter-spacing: 0.04em;
|
||||
white-space: nowrap;
|
||||
opacity: 0.45;
|
||||
transition: color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
|
||||
}
|
||||
.filter-item:hover { opacity: 0.75; }
|
||||
.filter-item.active {
|
||||
color: var(--hud);
|
||||
opacity: 1;
|
||||
transform: scale(1.08);
|
||||
}
|
||||
|
||||
.chip {
|
||||
border: 1.5px solid currentColor;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
line-height: 1.1;
|
||||
font-size: 13px;
|
||||
min-width: 32px;
|
||||
text-align: center;
|
||||
}
|
||||
.chip.name { padding: 2px 12px; }
|
||||
.filter-item.active .chip.num2 { background: var(--hud); color: #000; border-color: var(--hud); }
|
||||
|
||||
/* 中线 — 不跨视频,只局限在 wheel 内 */
|
||||
.wheel-indicator {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: calc(88px + 84px - 18px); /* 居中线对齐 active 项 */
|
||||
transform: translateX(-50%);
|
||||
width: 240px;
|
||||
height: 36px;
|
||||
z-index: 6;
|
||||
pointer-events: none;
|
||||
border-top: 1px solid rgba(255,255,255,0.18);
|
||||
border-bottom: 1px solid rgba(255,255,255,0.18);
|
||||
}
|
||||
/* 两侧小箭头提示 */
|
||||
.wheel-indicator::before,
|
||||
.wheel-indicator::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 8px; height: 8px;
|
||||
border: 1.5px solid var(--hud);
|
||||
transform: translateY(-50%) rotate(45deg);
|
||||
}
|
||||
.wheel-indicator::before { left: -16px; border-right: none; border-bottom: none; }
|
||||
.wheel-indicator::after { right: -16px; border-left: none; border-top: none; }
|
||||
|
||||
/* 操作提示(自动消失) */
|
||||
.help {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 270px;
|
||||
transform: translateX(-50%);
|
||||
pointer-events: none;
|
||||
z-index: 50;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.22em;
|
||||
color: var(--hud-dim);
|
||||
background: rgba(0,0,0,0.4);
|
||||
backdrop-filter: blur(6px);
|
||||
padding: 8px 16px;
|
||||
border: 1px solid rgba(255,255,255,0.2);
|
||||
border-radius: 3px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.4s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.help.show { opacity: 1; }
|
||||
.help kbd {
|
||||
display: inline-block;
|
||||
padding: 1px 6px;
|
||||
border: 1px solid var(--hud-dim);
|
||||
border-radius: 2px;
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 0;
|
||||
color: var(--hud);
|
||||
margin: 0 2px;
|
||||
}
|
||||
|
||||
/* 加载中 */
|
||||
.loading {
|
||||
position: absolute;
|
||||
top: 50%; left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 8;
|
||||
text-align: center;
|
||||
color: var(--hud);
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.3em;
|
||||
pointer-events: none;
|
||||
}
|
||||
.loading.hidden { display: none; }
|
||||
.loading .spinner {
|
||||
width: 32px; height: 32px;
|
||||
border: 1.5px solid var(--hud-dim);
|
||||
border-top-color: var(--hud);
|
||||
border-radius: 50%;
|
||||
margin: 0 auto 12px;
|
||||
animation: spin 0.9s linear infinite;
|
||||
}
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.fallback-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
background: radial-gradient(ellipse at 30% 40%, #1a1a1a 0%, #050505 70%), #000;
|
||||
display: none;
|
||||
}
|
||||
.fallback-bg.show { display: block; }
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.top-row, .bottom-row { left: 60px; right: 60px; font-size: 12px; }
|
||||
.badge { font-size: 11px; padding: 1px 6px; }
|
||||
.timecode { font-size: 15px; }
|
||||
.frame-corner { width: 38px; height: 38px; }
|
||||
.filter-wheel { width: 240px; bottom: 78px; }
|
||||
.wheel-indicator { width: 200px; bottom: calc(78px + 84px - 18px); }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="viewfinder" id="viewfinder">
|
||||
|
||||
<div class="fallback-bg" id="fallback"></div>
|
||||
|
||||
<div class="stage" id="stage">
|
||||
<div class="video-wrap" id="videoWrap">
|
||||
<video id="vid" class="f-original"
|
||||
autoplay muted loop playsinline preload="auto"
|
||||
crossorigin="anonymous"></video>
|
||||
</div>
|
||||
<div class="grain"></div>
|
||||
</div>
|
||||
|
||||
<div class="loading" id="loading">
|
||||
<div class="spinner"></div>
|
||||
LOADING
|
||||
</div>
|
||||
|
||||
<div class="hud">
|
||||
<div class="hud-pad">
|
||||
<div class="frame-corner fc-tl"></div>
|
||||
<div class="frame-corner fc-tr"></div>
|
||||
<div class="frame-corner fc-bl"></div>
|
||||
<div class="frame-corner fc-br"></div>
|
||||
|
||||
<div class="top-row">
|
||||
<div class="top-left">
|
||||
<span class="badge badge-a">A</span>
|
||||
<span class="badge">16:9</span>
|
||||
<span>25p</span>
|
||||
</div>
|
||||
<div class="top-right">
|
||||
<span class="badge">FX</span>
|
||||
<button class="rec-btn" id="recBtn" type="button" aria-label="play/pause">
|
||||
<span class="rec-dot" id="recDot"></span>
|
||||
<span id="recLabel">REC</span>
|
||||
</button>
|
||||
<span id="batPct">100%</span>
|
||||
<div class="battery"><span id="batFill"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="side-col side-left">
|
||||
<span class="badge">AF-S</span>
|
||||
<div class="icon"><svg viewBox="0 0 20 20"><rect x="3" y="3" width="14" height="14" rx="1"/><circle cx="10" cy="10" r="3"/></svg></div>
|
||||
<div class="icon-box">
|
||||
<div class="icon"><svg viewBox="0 0 20 20"><circle cx="10" cy="7" r="3"/><path d="M4 17c0-3 3-5 6-5s6 2 6 5"/></svg></div>
|
||||
<span>OFF</span>
|
||||
</div>
|
||||
<div class="icon-box">
|
||||
<div class="icon"><svg viewBox="0 0 20 20"><rect x="3" y="3" width="14" height="14" rx="1"/><path d="M5 15l10-10"/></svg></div>
|
||||
<span>OFF</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="side-col side-right">
|
||||
<div class="icon-box">
|
||||
<span>AUTO</span>
|
||||
<div class="icon"><svg viewBox="0 0 20 20"><circle cx="10" cy="10" r="2.5"/></svg></div>
|
||||
</div>
|
||||
<div class="icon-box"><span>AWB</span></div>
|
||||
</div>
|
||||
|
||||
<div class="reticle" id="reticle">
|
||||
<div class="c c1"></div>
|
||||
<div class="c c2"></div>
|
||||
<div class="c c3"></div>
|
||||
<div class="c c4"></div>
|
||||
<div class="dot"></div>
|
||||
</div>
|
||||
|
||||
<div class="bottom-row">
|
||||
<div class="bottom-left">
|
||||
<div class="stack"><span id="fStop">F3.5</span><span class="micro">APERTURE</span></div>
|
||||
<div class="stack"><span id="shutter">1/200</span><span class="micro">SHUTTER</span></div>
|
||||
</div>
|
||||
<div class="stack">
|
||||
<span class="timecode" id="timecode">00:00:00:00</span>
|
||||
<span class="micro" id="filterLabel">ORIGINAL · 4K</span>
|
||||
</div>
|
||||
<div class="bottom-right">
|
||||
<div class="stack"><span id="iso">ISO 100</span><span class="micro">ISO</span></div>
|
||||
<div class="stack"><span id="ev">± -0.5</span><span class="micro">EV</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 滤镜中线高亮 -->
|
||||
<div class="wheel-indicator"></div>
|
||||
|
||||
<!-- 纵向滚动滤镜选择器 -->
|
||||
<div class="filter-wheel" id="wheel">
|
||||
<div class="filter-list" id="list"></div>
|
||||
</div>
|
||||
|
||||
<!-- 操作提示 -->
|
||||
<div class="help" id="help">
|
||||
滚轮 / <kbd>↑</kbd><kbd>↓</kbd> 切换滤镜
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const videoSources = [
|
||||
'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4',
|
||||
'https://www.w3schools.com/html/mov_bbb.mp4',
|
||||
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
|
||||
'https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4'
|
||||
];
|
||||
|
||||
const filters = [
|
||||
{ id: 'original', n1: '01', n2: '00', name: 'Original', iso: '100', fStop: 'F3.5', shutter: '1/200', ev: '± -0.5', label: 'ORIGINAL · 4K' },
|
||||
{ id: 'vivid', n1: '02', n2: '15', name: 'Vivid', iso: '125', fStop: 'F2.8', shutter: '1/250', ev: '± +0.3', label: 'VIVID · POP' },
|
||||
{ id: 'fuji', n1: '03', n2: '55', name: 'Fujifilm', iso: '200', fStop: 'F4.0', shutter: '1/160', ev: '± +0.0', label: 'CLASSIC CHROME' },
|
||||
{ id: 'vintage', n1: '05', n2: '00', name: 'Vintage', iso: '400', fStop: 'F5.6', shutter: '1/125', ev: '± -0.7', label: 'VINTAGE 1977' },
|
||||
{ id: 'fisheye', n1: '07', n2: '01', name: 'Fisheye', iso: '160', fStop: 'F2.2', shutter: '1/320', ev: '± +0.0', label: 'FISHEYE · 8MM' },
|
||||
{ id: 'cinema', n1: '09', n2: '08', name: 'Cinema', iso: '320', fStop: 'F2.0', shutter: '1/100', ev: '± -1.0', label: 'CINEMA · 2.35:1' },
|
||||
{ id: 'mono', n1: '11', n2: '21', name: 'Mono', iso: '800', fStop: 'F8.0', shutter: '1/500', ev: '± -0.3', label: 'MONO · TRI-X' },
|
||||
{ id: 'cold', n1: '13', n2: '44', name: 'Cold', iso: '250', fStop: 'F3.2', shutter: '1/200', ev: '± -0.2', label: 'COLD · ARCTIC' },
|
||||
];
|
||||
|
||||
const ITEM_H = 36;
|
||||
|
||||
const $ = id => document.getElementById(id);
|
||||
const list = $('list');
|
||||
const vid = $('vid');
|
||||
const stage = $('stage');
|
||||
const videoWrap = $('videoWrap');
|
||||
const reticle = $('reticle');
|
||||
const loading = $('loading');
|
||||
const fallback = $('fallback');
|
||||
let currentIdx = 0;
|
||||
|
||||
/* ---------- 视频加载 ---------- */
|
||||
let srcIndex = 0;
|
||||
function tryNextSource() {
|
||||
if (srcIndex >= videoSources.length) {
|
||||
loading.classList.add('hidden');
|
||||
fallback.classList.add('show');
|
||||
return;
|
||||
}
|
||||
vid.src = videoSources[srcIndex];
|
||||
vid.load();
|
||||
srcIndex++;
|
||||
}
|
||||
vid.addEventListener('canplay', () => {
|
||||
loading.classList.add('hidden');
|
||||
fallback.classList.remove('show');
|
||||
vid.play().catch(() => {});
|
||||
});
|
||||
vid.addEventListener('error', tryNextSource);
|
||||
let loadTimer;
|
||||
function resetLoadTimer() {
|
||||
clearTimeout(loadTimer);
|
||||
loadTimer = setTimeout(() => {
|
||||
if (vid.readyState < 3) { tryNextSource(); resetLoadTimer(); }
|
||||
}, 10000);
|
||||
}
|
||||
resetLoadTimer();
|
||||
tryNextSource();
|
||||
|
||||
/* ---------- 渲染滤镜列表 ---------- */
|
||||
filters.forEach((f, i) => {
|
||||
const el = document.createElement('div');
|
||||
el.className = 'filter-item' + (i === currentIdx ? ' active' : '');
|
||||
el.dataset.idx = i;
|
||||
el.innerHTML = `
|
||||
<span class="chip num1">${f.n1}</span>
|
||||
<span class="chip num2">${f.n2}</span>
|
||||
<span class="chip name">${f.name}</span>
|
||||
`;
|
||||
el.addEventListener('click', () => setFilter(i));
|
||||
list.appendChild(el);
|
||||
});
|
||||
|
||||
function setFilter(idx) {
|
||||
if (idx < 0 || idx >= filters.length) return;
|
||||
currentIdx = idx;
|
||||
const f = filters[idx];
|
||||
|
||||
vid.className = 'f-' + f.id;
|
||||
videoWrap.classList.toggle('fisheye', f.id === 'fisheye');
|
||||
|
||||
stage.classList.remove('flash');
|
||||
void stage.offsetWidth;
|
||||
stage.classList.add('flash');
|
||||
|
||||
[...list.children].forEach((el, i) => {
|
||||
el.classList.toggle('active', i === idx);
|
||||
});
|
||||
|
||||
/* 纵向居中:把 active 项移到中线(top: 50%) */
|
||||
/* active 元素的 top(相对 list) = idx * ITEM_H
|
||||
list 的 top = 50%(中线),要让 active 的中心也对齐中线
|
||||
=> translateY = -(idx * ITEM_H) - ITEM_H/2 */
|
||||
const offset = -(idx * ITEM_H) - ITEM_H / 2;
|
||||
list.style.transform = `translateY(${offset}px)`;
|
||||
|
||||
$('iso').textContent = 'ISO ' + f.iso;
|
||||
$('fStop').textContent = f.fStop;
|
||||
$('shutter').textContent = f.shutter;
|
||||
$('ev').textContent = f.ev;
|
||||
$('filterLabel').textContent = f.label;
|
||||
|
||||
reticle.classList.remove('focus');
|
||||
void reticle.offsetWidth;
|
||||
reticle.classList.add('focus');
|
||||
}
|
||||
|
||||
/* 键盘:上下切换 */
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') { e.preventDefault(); setFilter((currentIdx - 1 + filters.length) % filters.length); }
|
||||
if (e.key === 'ArrowDown' || e.key === 'ArrowRight') { e.preventDefault(); setFilter((currentIdx + 1) % filters.length); }
|
||||
if (e.code === 'Space') { e.preventDefault(); vid.paused ? vid.play() : vid.pause(); }
|
||||
if (e.key === 'f' || e.key === 'F') {
|
||||
if (!document.fullscreenElement) document.documentElement.requestFullscreen?.();
|
||||
else document.exitFullscreen?.();
|
||||
}
|
||||
});
|
||||
|
||||
/* 滚轮:在 wheel 区域内或整个 viewfinder 都能滚 */
|
||||
let wheelLock = false;
|
||||
function onWheel(e) {
|
||||
e.preventDefault();
|
||||
if (wheelLock) return;
|
||||
wheelLock = true;
|
||||
setTimeout(() => wheelLock = false, 200);
|
||||
const dir = (e.deltaY > 0 || e.deltaX > 0) ? 1 : -1;
|
||||
setFilter((currentIdx + dir + filters.length) % filters.length);
|
||||
}
|
||||
$('wheel').addEventListener('wheel', onWheel, { passive: false });
|
||||
/* 整个 viewfinder 区域也可滚轮切换(更直观) */
|
||||
$('viewfinder').addEventListener('wheel', onWheel, { passive: false });
|
||||
|
||||
/* 触摸滑动 */
|
||||
let touchStartY = null;
|
||||
$('wheel').addEventListener('touchstart', e => {
|
||||
touchStartY = e.touches[0].clientY;
|
||||
}, { passive: true });
|
||||
$('wheel').addEventListener('touchmove', e => {
|
||||
if (touchStartY === null) return;
|
||||
const dy = e.touches[0].clientY - touchStartY;
|
||||
if (Math.abs(dy) > 30) {
|
||||
const dir = dy < 0 ? 1 : -1;
|
||||
setFilter((currentIdx + dir + filters.length) % filters.length);
|
||||
touchStartY = null;
|
||||
}
|
||||
}, { passive: true });
|
||||
|
||||
/* 点击对焦(避开底部 HUD 与滤镜轮) */
|
||||
stage.addEventListener('click', e => {
|
||||
if (e.clientY > window.innerHeight - 280) return;
|
||||
const rect = stage.getBoundingClientRect();
|
||||
const x = e.clientX - rect.left;
|
||||
const y = e.clientY - rect.top;
|
||||
reticle.style.transition = 'none';
|
||||
reticle.style.top = y + 'px';
|
||||
reticle.style.left = x + 'px';
|
||||
reticle.classList.remove('focus');
|
||||
void reticle.offsetWidth;
|
||||
reticle.style.transition = '';
|
||||
reticle.classList.add('focus');
|
||||
setTimeout(() => {
|
||||
reticle.style.top = '50%';
|
||||
reticle.style.left = '50%';
|
||||
}, 1500);
|
||||
});
|
||||
|
||||
/* 时间码 */
|
||||
let startTs = null;
|
||||
function tickTimecode(ts) {
|
||||
if (!startTs) startTs = ts;
|
||||
const elapsed = (ts - startTs) / 1000;
|
||||
const totalFrames = Math.floor(elapsed * 25);
|
||||
const ff = totalFrames % 25;
|
||||
const ss = Math.floor(totalFrames / 25) % 60;
|
||||
const mm = Math.floor(totalFrames / 1500) % 60;
|
||||
const hh = Math.floor(totalFrames / 90000);
|
||||
$('timecode').textContent =
|
||||
String(hh).padStart(2,'0') + ':' +
|
||||
String(mm).padStart(2,'0') + ':' +
|
||||
String(ss).padStart(2,'0') + ':' +
|
||||
String(ff).padStart(2,'0');
|
||||
requestAnimationFrame(tickTimecode);
|
||||
}
|
||||
requestAnimationFrame(tickTimecode);
|
||||
|
||||
/* 电量 */
|
||||
let battery = 100;
|
||||
setInterval(() => {
|
||||
battery = Math.max(12, battery - 1);
|
||||
$('batPct').textContent = battery + '%';
|
||||
$('batFill').style.width = battery + '%';
|
||||
if (battery < 25) $('batFill').style.background = '#ff9f0a';
|
||||
if (battery < 15) $('batFill').style.background = '#ff3b30';
|
||||
}, 8000);
|
||||
|
||||
/* 操作提示 */
|
||||
const help = $('help');
|
||||
setTimeout(() => help.classList.add('show'), 800);
|
||||
setTimeout(() => help.classList.remove('show'), 4200);
|
||||
|
||||
/* 播放/暂停按钮 */
|
||||
const recBtn = $('recBtn');
|
||||
const recLabel = $('recLabel');
|
||||
function updateRec() {
|
||||
if (vid.paused) {
|
||||
recBtn.classList.add('paused');
|
||||
recLabel.textContent = 'PAUSED';
|
||||
} else {
|
||||
recBtn.classList.remove('paused');
|
||||
recLabel.textContent = 'REC';
|
||||
}
|
||||
}
|
||||
recBtn.addEventListener('click', e => {
|
||||
e.stopPropagation();
|
||||
if (vid.paused) vid.play(); else vid.pause();
|
||||
});
|
||||
vid.addEventListener('play', updateRec);
|
||||
vid.addEventListener('pause', updateRec);
|
||||
|
||||
/* 初次定位 */
|
||||
setTimeout(() => setFilter(0), 50);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user