Loading video...

Video Failed to Load

Go Home

5 min cursor trails with grid + CSS custom properties 💫 .grid div { opacity: var(--o); transition: opacity 0.8s, rotate 0.4s; &:hover { transition-duration: 0s; rotate: calc(var(--r, 0) * 90deg); opacity: 1; }} trick: dynamic :hover transition

358,016 views • 1 year ago •via X (Twitter)

47 Comments

nick! at the disco 🕺🏻's profile picture
nick! at the disco 🕺🏻1 year ago

made a similar one with canvas a few years back, definitely took more than 5 mins >

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

would def recommend going the <canvas> route 👏

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

p.s if you're gonna make a big grid, think about moving to <canvas> 🙏 (can show that one too if you want) the cool thing with using <div> quick like this is it's a nice way to learn about some CSS superpowers ⚡ (scoped custom properties, dynamic transition, etc.)

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

here's the @CodePen if you wanna make your own 🤙 you'll see it's like ~30 lines of CSS (minus theme stuff)

Sam ☕'s profile picture
Sam ☕1 year ago

Cooked hard💥

Aqeel's profile picture
Aqeel1 year ago

Isn't this kinda same. btw i build this to practice js.

Tom Siwik's profile picture
Tom Siwik1 year ago

shader version more perf?

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

100% if you got it 👨‍🍳

Rohit's profile picture
Rohit1 year ago

U upgraded it a premium component 🥶

rezan's profile picture
rezan1 year ago

supa cute supa fun

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

🙏🙏🙏

The Doctor's profile picture
The Doctor1 year ago

Off topic but I have a question. How does one do the +s on the corner of the divs to mimick that they are focused? I can't find any information on this on the internet because idk how to search for it or what it's called 😅

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

got an image?

The Doctor's profile picture
The Doctor1 year ago

I could have sworn i bookmarked the post but i cant find but i made a sketch. Basically youd have your usual divs but on the corners you will have plus/crosses. Idk how to do this other than spamming svgs with absolute position...

@pink's profile picture
@pink1 year ago

@jh3yy just add relative property to the div and create 4 “+” spans with absolute positioning

The Doctor's profile picture
The Doctor1 year ago

@jh3yy It's fine for one or two div but what about tens or hundreds of divs

Dan Loewenherz's profile picture
Dan Loewenherz1 year ago

This is so cool! Why isn’t the transition-duration: 0s a no-op?

Mike Deufel's profile picture
Mike Deufel1 year ago

CSS is OP; bit scared that it gets nerfed in next release

Sam Nord's profile picture
Sam Nord1 year ago

How can I make one with custom SVG Icons

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

swap out the <div> for an <svg> or even an <img> 🤙 same concept applies – you could even do it to an SVG grid that has a bunch of <use> laid out 👨‍🍳

alex's profile picture
alex1 year ago

Doesn’t work on mobile well

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

fixed that 😉

alex's profile picture
alex1 year ago

Wow i’m impressed! It works so well on the phone as well. An absolute masterpiece.

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

thanks for the push 🙏 few lines of JS and a little extra CSS 🤙

ⓝⓔⓚⓡⓞⓟⓤⓝⓚ's profile picture
ⓝⓔⓚⓡⓞⓟⓤⓝⓚ1 year ago

ahhhhh

kachi's profile picture
kachi1 year ago

Thanks. But I don't even know i am Thanking you. You guys are I just really good.

Alex Cloudstar's profile picture
Alex Cloudstar1 year ago

Playing with CSS custom properties feels like magic. I remember setting up a background color swap and feeling like I unlocked a secret level.

Erfan's profile picture
Erfan1 year ago

I've never used this trick. am I understanding it right that transition-duration: 0s; is meant for cases where you hover an element again while its transition is still running? basically to prevent janky animations?

Tavqeer Hussain's profile picture
Tavqeer Hussain1 year ago

Wow that's great buddy 😊👏

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

thanks 🤙

LaunchTube App's profile picture
LaunchTube App1 year ago

There's something so compelling and fun about little UI details like this. Add a useful function to this and you'd have an addictive app.

DUBEM's profile picture
DUBEM1 year ago

Finally I've found you 🫵 Loved your designs from @CodePen

jhey ʕ•ᴥ•ʔ's profile picture
jhey ʕ•ᴥ•ʔ1 year ago

@CodePen ahh - appreciate that 🙏

DUBEM's profile picture
DUBEM1 year ago

@CodePen I have some issues that I'd love your assistance, I'm in your DM 🙏

soup's profile picture
soup1 year ago

STEALING THIS THANKS

Alex Gorbachev's profile picture
Alex Gorbachev10 months ago

Wow!

skopega's profile picture
skopega1 year ago

It looks so good, well done :)

notafrog's profile picture
notafrog1 year ago

the little spins go a long way, love it!

Kirk Ouimet's profile picture
Kirk Ouimet1 year ago

Love this, so playful

Jevian Studio's profile picture
Jevian Studio1 year ago

That’s Sick👌🏽

Adham🇱🇷's profile picture
Adham🇱🇷1 year ago

Wow

em's profile picture
em1 year ago

So cute

Nacho Gavilanes's profile picture
Nacho Gavilanes1 year ago

This is mesmerizing ⁂

0xKDBON 🌊 RIVER|.edge🦭's profile picture
0xKDBON 🌊 RIVER|.edge🦭1 year ago

Love the rotate hack

Ashutosh Ajgaokar ⚡️'s profile picture
Ashutosh Ajgaokar ⚡️1 year ago

nice

Lucas's profile picture
Lucas1 year ago

So cute 🥰

Dr.Q's profile picture
Dr.Q1 year ago

Interesting!

Related Videos