Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

CSS Trick 🫠 You can create gooey effects with filter using CSS or SVG if you want color 🎨 .blobs { filter: blur(20px) contrast(30); } .blobs { filter: url(#​goo); } The trick is to blur the thing, then cut the blur off with contrast. You can make some cool...

190,822 Aufrufe • vor 2 Jahren •via X (Twitter)

11 Kommentare

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Here's that @CodePen link! 🚀 Really worth messing with the values in DevTools and seeing what a difference it makes and the kind of effects you can create 🤓

Profilbild von Robert McGovern
Robert McGovernvor 2 Jahren

Neat effect, made me wonder if could be used for a CSS Lava lamp On off chance searched Codepen and guess who was the top hit

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Haha 😅 That one could probably do with a revisit at some point. Funny because these trends go round in cycles. Have a bunch of "Gooey" filter demos from the first time I saw SVG filters which would be wayyyy back now 🥲

Profilbild von abelardoit🐦
abelardoit🐦vor 2 Jahren

007? :d

Profilbild von doug chang
doug changvor 2 Jahren

wow!!!!

Profilbild von Alexander Schranz
Alexander Schranzvor 2 Jahren

Maybe with some kind of filter you even can create other colors. Not sure yet why the second bubble isnt showing.

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Exactly that! 🤙 People tend to reach for the SVG filter for ease of use. Like that use of sepia and then the hue-rotate to finish. If you reduce the blur on the level up, it should come back 🤞

Profilbild von Álvaro Montoro
Álvaro Montorovor 2 Jahren

It's not limited to black and white in CSS. It works with other colors too, which also makes it easier to generate other colors by applying additional filters like sepia() and hue-rotate().

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Not "limited" but it is in the sense that you can't just use "background-color" which is what most people would want to use to change color.

Profilbild von Ahmad Fathy
Ahmad Fathyvor 2 Jahren

This brings back some memories 🥹

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Right?! Love that demo by the way, when they merge it reminds me of Dr. Mario 😅

Ähnliche Videos

CSS Tip! 🤙 You can use mask-composite and some JavaScript to create this pointer proximity following glow border ✨ .glow { mask-composite: intersect; mask-clip: padding-box, border-box; mask: linear-gradient(#0000, #0000), conic-gradient(#0000 0deg, #​fff, #0000 45deg); } The trick is to mask a background-image with a combination of mask layers. mask-composite: intersect; means the mask used will be the intersection of the layers 🔥 use source-in, xor; in browsers that don't support intersect; In this demo, you can use pseudoelements and rely on scoped custom properties to do a lot of the heavy lifting for you 🙌 Once you've masked the background, you need to update the starting angle of the conic-gradient on pointermove 👆 You can work that out by getting the center point of each card and then calculating the angle between that and the pointer with Math.atan2 🤓 let ANGLE = Math.atan2( event?.y - CARD_CENTER[1], event?.x - CARD_CENTER[0] ) * 180 / Math.PI ANGLE = ANGLE < 0 ? ANGLE + 360 : ANGLE; CARD.​style.setProperty('--start', ANGLE + 90) You plug that into your conic-gradient mask as a custom property accounting for --spread ⚡️ conic-gradient(from calc((var(--angle) - (var(--spread) * 0.5)) * 1deg), #000 0deg, #​fff, #0000 calc(var(--spread) * 1deg)); To get the blur, you apply a blur to the glow container on each card 🤙 .glows { filter: blur(calc(var(--blur) * 1px); } That's it! Layers of masks that are clipped and composited before being blurred 😎 The added trick is to fade each one in when the pointer is in the defined proximity of the card. For example, don't show unless within 100px of a card. You can see that in the video. Check out the JavaScript code for that 🫶 Couldn't resist making this one 😁 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

1,179,837 Aufrufe • vor 2 Jahren

CSS Tip! 💪 You can create these tab controls with CSS :has() + radio buttons ✨ .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } .tabs::after { translate: calc(var(--active, 0) * 100%) 0; width: calc(100% / var(--count)); } Two CSS :has() tricks here combined with a rendering trick 🤙 The tab control is a container using display: grid. You can use :has() to count the number of tabs in the container: .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(input:nth-of-type(4)) { --count: 4; } Using the cascade, the last valid :has() gives you the number of tabs 🫶 Once you know the number of tabs, you know how to size the indicator: .tabs::after { content: ""; position: absolute; height: 100%; width: calc(100% / var(--count)); } It's a pseudoelement that uses --count to determine its size 📏 The next :has() trick is determining which tab is active or :checked as it's an input [type=radio] .tabs:has(:checked:nth-of-type(2)) { --active: 1; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } You can use a zero-indexed translation here. If the second input is :checked, set --active: 1, then translate the pseudoelement on the tabs to that position 👉 .tabs::after { translate: calc(var(--active, 0) * 100%) 0; } The last rendering trick is using mix-blend-mode 👀 The tabs have a black background-color, the pseudoelement is white, and the label text is white. When you use mix-blend-mode: difference on the pseudoelement it will give this effect that the text transitions from white to black sliding across 😎 .tabs::after { color: hsl(0 0% 100%); mix-blend-mode: difference; } You can totally mix up the colors here though and go with a different effect. The mechanics of how you can use CSS :has() is the main point here 🙏 As always, any questions, suggestions, etc. let me know CodePen.IO link below! 👇 (There's even a Tailwind CSS play for this one too 👀)

jhey ʕ•ᴥ•ʔ

437,426 Aufrufe • vor 2 Jahren