Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
Spotlight
- focus -
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } @import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap"); :root { --x: 50vw; --y: 43vh; --size: max(70vmin, 250px); --blur: 0.5vmax; } * { margin: 0; padding: 0; box-sizing: border-box; } html, body { background-color: black; overscroll-behavior-x: none; overscroll-behavior-y: none; overflow: hidden; /* cursor: none; */ user-select: none; } body { pisition: relative; width: 100vw; height: 100vh; font-family: "Montserrat", serif; text-align: center; line-height: 1; color: #333; display: flex; justify-content: center; align-items: center; } main { pisition: relative; color: crimson; mix-blend-mode: color-burn; z-index: 0; } h1 { font-size: max(18vmin, 50px); } h2 { margin-top: 0.2em; font-size: max(10vmin, 40px); } #bg { /* filter: brightness(0.8) blur(0.5vmax); */ filter: blur(var(--blur)); } #bg, #bg_mask { /* ふちボケ対策 */ position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: calc(var(--blur) * -1); background-image: url(https://images.unsplash.com/photo-1532153955177-f59af40d6472?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2OTg2NTgxNzR8&ixlib=rb-4.0.3&q=100&w=2000); background-size: cover; background-repeat: no-repeat; background-position: center; z-index: 0; } #spotlight, #bg_mask { background-color: rgba(0, 0, 0, 0.6); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='546.133' height='448' viewBox='-20 -20 552 460'%3E%3Cdefs%3E%3Cfilter id='filter'%3E%3CfeGaussianBlur stdDeviation='10' /%3E%3C/filter%3E%3C/defs%3E%3Cpath fill='black' filter='url(%23filter)' d='M257 112c.28-12.93 5.99-29.47 11.75-41C300.62 7.27 376.04-17.2 440 12.31c33.67 15.54 60.35 48.63 68.77 84.69 4.11 17.63 3.43 29.19 3.23 47-.23 19.09-8.22 50.95-14.95 69C468.4 289.85 404.82 349.11 333 386.26L278 412c-4.6 1.84-17.87 7.79-22 7.79-4.18 0-20.12-7.02-25-8.99-21.1-8.51-41.08-18.56-61-29.5C95.65 340.48 30.02 274.83 7.88 191 .49 162.99-.33 146.56 0 118c.17-14.32 6.36-34.21 12.75-47C19.82 56.86 29.21 43.78 41 33.17c49.22-44.3 123.25-44.16 173-.88 10.52 9.15 20.7 22.36 27.22 34.71 6.75 12.8 13.46 30.42 13.78 45h2Z'/%3E%3C/svg%3E"), linear-gradient(#fff 0 0); mask-size: var(--size), 100%; mask-position: calc(var(--x) - var(--size) / 2) calc(var(--y) - var(--size) / 2 * 0.65), left top; mask-repeat: no-repeat; mask-mode: alpha; } #spotlight { position: fixed; top: 0; left: 0; height: 100vh; width: 100vw; -webkit-mask-composite: destination-out; mask-composite: exclude; z-index: 1; } #bg_mask { mask-size: var(--size), 0; }
console.log("Event Fired") /*! Spotlight - focus - blur effect @wakana-k https://codepen.io/wakana-k/pen/ZEwWWmV */ "use strict"; console.clear(); var root = document.querySelector(":root"); function spotlight(e) { root.style.setProperty("--x", e.pageX + "px"); root.style.setProperty("--y", e.pageY + "px"); } window.addEventListener("pointermove", spotlight); window.addEventListener("pointerdown", spotlight);