Hidden playground · 隐藏实验页面 · /lab · hover or click each card · 悬停或点击交互
rotateX / rotateY 角度(±30°)。父元素设置 perspective: 800px 产生深度感。高光叠加层反向偏移模拟镜面反光,requestAnimationFrame 线性插值实现丝滑过渡。 Mouse offset from element center maps to rotateX / rotateY (±30°). CSS perspective: 800px creates depth. A highlight overlay shifts opposite to simulate specular reflection, smoothed via RAF lerp.
feColorMatrix 分别隔离 R、G、B 通道,以 mix-blend-mode: screen 混合。悬停时,JS 每 60ms 随机偏移各通道 translateX 并用 clip-path 切割扫描线区域,产生撕裂故障效果。 Three image copies isolated to R, G, B via SVG feColorMatrix with mix-blend-mode: screen. On hover, a JS interval randomises translateX and clip-path slices every 60ms creating glitch tears.
drawImage() 绘制到离屏画布,getImageData() 采样点击坐标的像素颜色。生成 80 个粒子携带采样色彩以随机速度向外扩散,在重力与透明度衰减下消散。纯 Canvas 2D,零依赖。 On click, getImageData() samples the pixel color at the click point. 80 particles spawn with that color and random velocity vectors, decaying under gravity. Pure Canvas 2D, no libraries.
feTurbulence → feDisplacementMap 滤镜链作用于图像。鼠标与元素中心的距离实时控制 baseFrequency(波纹密度)和位移 scale(扭曲强度)。每帧递增 seed,使湍流持续流动,产生生动的液态形变效果。 SVG feTurbulence → feDisplacementMap applied to the image. Mouse distance controls baseFrequency and displacement scale live. The seed increments each frame for a continuously flowing, living distortion.
hue-rotate()(0–360°)和 brightness()。一个带 mix-blend-mode: color 的七色彩虹渐变叠加层跟随鼠标偏移 background-position,模拟全息卡片随视角变换颜色的光变效果。 Mouse X/Y across the image maps to CSS hue-rotate() (0–360°) and brightness(). A rainbow gradient overlay with mix-blend-mode: color shifts its background-position with the cursor, simulating the iridescent color-shift of a holographic trading card.
● REC ::before 伪元素用 repeating-linear-gradient 绘制扫描线;(2) ::after 径向渐变实现晕影;(3) CSS filter: brightness/contrast/saturate 作用于图像。@keyframes 以不规则间隔模拟磷光体余辉闪烁,点击切换开关。 Three layers build the CRT illusion: ::before scanlines via repeating-linear-gradient, ::after radial vignette, and CSS filter on the image. A @keyframes flicker animation drops opacity at irregular intervals to simulate phosphor persistence. Click to toggle.
ctx.clip() 创建圆形裁剪区域,在其中以 2.5× 缩放绘制图像的局部区域。透明玻璃质感通过白色高光环与内部阴影叠加实现。Canvas 其余区域保持透明,原图正常显示于底层。 A canvas overlay draws a circular magnifying lens following the mouse. ctx.clip() creates the circular region where the image is drawn at 2.5× zoom. A glass-like highlight ring and inner shadow complete the illusion. The rest of the canvas stays transparent.
getImageData() 采样每个格子的像素亮度,映射到 ASCII 字符集(空格→@,由稀到密)。每个字符以像素原色染色后渲染到前景 Canvas,形成彩色字符画效果,鼠标离开时淡出还原。 On hover, getImageData() samples pixel brightness per grid cell, mapped to an ASCII charset (space → @). Each character is colored with the sampled pixel color and rendered to a foreground canvas, creating colored ASCII art. Mouse leave fades it out.
imageSmoothingEnabled),再放大至原尺寸,产生马赛克效果,块尺寸随帧递增至 30px。离开时反向缩减至 1px,图像逐渐恢复清晰。纯 Canvas,无 CSS 滤镜。 On hover, canvas redraws the image with increasing block size — scaling down (with imageSmoothingEnabled: false) then back up creates pixelation. Block size grows to 30px on enter and shrinks back to 1px on leave. Pure Canvas, no CSS filters.
mix-blend-mode: screen 与底图叠加,产生彩色发光效果。当两球距离小于半径之和时,用三次贝塞尔曲线在它们之间绘制"桥梁"圆弧,模拟有机融合的视觉效果。 6 colored glow orbs float above the profile — one tracks the mouse. Each orb is a radial gradient overlaid with mix-blend-mode: screen, tinting the photo with neon color. When two orbs overlap, a cubic Bézier bridge arc is drawn between them to simulate the organic merge of true metaballs.
mousemove 在鼠标坐标处生成 6 个粒子,色相随时间递增产生彩虹渐变,粒子以随机速度向外扩散并受轻微重力下坠。Canvas 每帧以极低透明度清除(不完全清空),保留前帧残影形成拖尾消散效果。所有粒子通过径向渐变绘制,透明度与尺寸逐帧衰减直至消失,在头像上方留下发光火焰轨迹。 Each mousemove over the image spawns 6 particles with an incrementing hue for rainbow cycling. The canvas is faded each frame with a semi-transparent clear (not fully erased) to leave ghost trails. Particles spread outward with slight gravity, drawn as radial-gradient glows whose alpha and size decay until they disappear — painting a fire trail over the photo.
perlin(x×scale, y×scale + t) 获得当前位置的流场角度,以极低不透明度的彩色短线绘制运动轨迹。随着 t 缓慢递增,流场持续演化,粒子轨迹层叠形成烟雾般流动的彩色光纹,覆盖于头像之上。 2D Perlin noise is implemented inline (permutation table + gradient interpolation). 200 particles are distributed over the profile surface; each frame they query perlin(x×scale, y×scale+t) for a flow angle and draw a hairline stroke at near-zero opacity. As t slowly advances the field evolves, and accumulated strokes layer into smoke-like colored flow ribbons drifting across the photo.
fillRect 绘制深色遮罩,再通过 globalCompositeOperation: destination-out 在鼠标位置"打孔",露出底层图像。径向渐变柔化边缘,聚光半径弹性过渡模拟镜头光圈开合。鼠标离开后聚光收合,图像重归黑暗。 A canvas overlay fills a dark mask, then destination-out composite punches a soft hole at the cursor, revealing the image beneath. A radial gradient softens the edge; the radius spring-transitions like an aperture. Mouse leave closes the light. clip-path: polygon() 剪出碎片形状。悬停时,CSS transition(cubic-bezier 弹性曲线)驱动每块向外位移并微旋,模拟玻璃破碎瞬间。纯 CSS,零 JS。 8 absolutely-positioned divs share the same background image; each is clipped by a unique clip-path: polygon(). On hover, CSS transition with a cubic-bezier spring drives each shard outward with a slight rotation — the instant a pane of glass shatters. Zero JavaScript.
getImageData() 读取每像素亮度(0–255),映射至热成像调色板:暗部→紫蓝(冷区),中间调→绿色(温区),亮部→黄橙红(热区)。重映射像素写入 ImageData 后 putImageData() 呈现,形成红外热像仪视觉。 On hover, getImageData() reads each pixel's brightness (0–255) and maps it to a thermal palette: darks → purple/blue (cold), mids → green (warm), brights → yellow/orange/red (hot). Remapped pixels are written back via putImageData(), producing an infrared thermal camera look.
sin(y × freq + t) × amp,振幅由鼠标与中心的距离实时控制(最大 ±14px)。鼠标靠近时波浪增强,离开后振幅缓降至 0,产生流动的水面折射效果。 Canvas redraws the image scanline by scanline each frame: row y's horizontal offset is sin(y × freq + t) × amp, with amplitude driven live by mouse proximity (max ±14px). Approaching intensifies the wave; leaving decays it — a sinusoidal water-refraction illusion.
mix-blend-mode: screen 叠加于头像,柱体振幅随正弦波缓慢摆动,模拟极光在夜空中舞动的流光。 Mouse entry spawns 6 vertical aurora columns near the cursor X, with hues cycling over time (cyan→magenta→violet). Each column is a linear-gradient beam composited via mix-blend-mode: screen. Column positions oscillate sinusoidally, simulating the dancing curtains of a real aurora borealis.
lineCap: round,宽 70px)而非孤立圆点。拖动时形成流畅的画笔涂抹效果,覆盖范围更广;笔触在 ~2 秒内自动淡出,头像重现。 Same erase-and-heal technique as Effect 22, but consecutive mouse positions are connected as thick rounded line segments (lineCap: round, width 70px). Dragging produces smooth, broad brush strokes that cover the photo; strokes fade out automatically in ~2s, letting the image resurface.
Photo BeforeAfter.astro):一个透明的全尺寸 <input type="range"> 同时充当拖拽面与键盘/读屏控件,其值写入 --ba-pos 自定义属性;前图用 clip-path: inset() 按该百分比裁剪,手柄线用同一变量定位 — 零指针数学。 Reusable comparison slider (BeforeAfter.astro): an invisible full-size <input type="range"> is both the drag surface and the keyboard/screen-reader control. Its value feeds the --ba-pos custom property; the before layer clips via clip-path: inset() and the handle tracks the same variable — no pointer math.
mousemove 在光标周围随机散射 12~16 个背景色小圆点(半径 5~18px,角度与距离均随机),形成颗粒状纹理遮盖效果。各尘点独立计时并随机延迟消散,产生沙粒般逐渐显现的动态感,头像在尘埃散去后复原。 Each mousemove scatters 12-16 small background-colored dots (radius 5-18px) at random angles and distances around the cursor, creating a grainy textured cover. Each dust particle has an independent fade timer with random delay — producing a sand-dispersal quality as the photo fades out and back in.