Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

spritesheets are, and always will be, a fun trick! ⚡ translate with css based on pointer position grace note™ blink included ♪

154,132 Aufrufe • vor 1 Monat •via X (Twitter)

55 Kommentare

Profilbild von Peter Petrash
Peter Petrashvor 1 Monat

spritesheeted myself for my site ☺️ it has a mood system underneath including easter egg behaviors (eg. try hypnotizing it with your mouse)

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

haha 😅 that's real good i think where this one wins is because it doesn't try to be the "centerpiece", it's one of those where you've lined it up to be discovered easily, but then lets the user feel like they discovered it 👏

Profilbild von Peter Petrash
Peter Petrashvor 1 Monat

appreciate it Jhey 👊

Profilbild von Boyd
Boydvor 1 Monat

I did something similar to this but for my dog.

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

love it - that's so good! 🐶

Profilbild von Boyd
Boydvor 1 Monat

Least I could do for him. He was a huge personality in our house.

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

i have no doubts from the pictures 🥲 such a lovely tribute 🫶

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

and of course, sorry for your loss Boyd, never quite know what the right words are 🙏 but, the "love it – it's so good" were definitely in regards to how well you have delivered that tribute 🫶

Profilbild von Boyd
Boydvor 1 Monat

Thanks! We miss him as a family but time has healed the immediate loss. Appreciate the kind words both about Pi and the project.

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

i didn't bookmark the post i saw doing the rounds for this the other day 🤦‍♂️ but saw a bunch of 'em so if someone has it to reference 🙏

Profilbild von Chauve Camille
Chauve Camillevor 1 Monat

😮

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

that's the one i was looking for to QT 🙏 different technique but the same concept 💯

Profilbild von oil-oil
oil-oilvor 1 Monat

I also implemented a similar effect on my website,

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

had a few questions about this one 🤙 - quick way: generate a video based on a character map and use ffmpeg etc. to split frames and create the sprite (you don't need a 3mb sprite file! compress!) - smoothing: track pointer pos + eased pos. the eased pos plays catch up, use that

Profilbild von Joel Stransky ✨
Joel Stransky ✨vor 1 Monat

I did this in 2005 in Flash.

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

never got to play with flash 🥲

Profilbild von Joel Stransky ✨
Joel Stransky ✨vor 1 Monat

You would have been the best of us.

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

ha 😅 i highly doubt that but from what i understand, that was an incredibly fun/creative era

Profilbild von Hurricane Zane
Hurricane Zanevor 1 Monat

where is beaver demo? my son is requesting access

Profilbild von Techies Reviews
Techies Reviewsvor 1 Monat

Wohoo sprites are back baby!

Profilbild von dennys dionigi
dennys dionigivor 1 Monat

Fun trick also here 😆

Profilbild von Geryy
Geryyvor 1 Monat

Back in my times we used sprite sheets for button hover states.... 🧓

Profilbild von mr.tipton
mr.tiptonvor 1 Monat

I love sprite sheets. I built a native utility app with sprite sheets being the UI. Haha This one is so good! Love the look and smoothness

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

sprites are always fun! i did put a little "smoothing" slider in there to try help things out on it 😁

Profilbild von mr.tipton
mr.tiptonvor 1 Monat

Looks great man

Profilbild von Jimmy Lee
Jimmy Leevor 1 Monat

This is so good, the future of avatars

Profilbild von Brayan
Brayanvor 1 Monat

Any tips on smooth sprite animations?

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

in this case, keep the pointer position as "the target" then lerp/ease a separate value towards it on every frame and use that eased value to drive the spritesheet frame you’re smoothing the input, not the sprite itself 🤙

Profilbild von Ismael
Ismaelvor 1 Monat

Wait, I need this for my website

Profilbild von Ahmed Dahbi
Ahmed Dahbivor 1 Monat

wow super cool! love the blink 😉

Profilbild von Occam’s Orange
Occam’s Orangevor 1 Monat

How did you generate the sprite in the first place? When i tried using gpt image or gemini, it keep duplicating the same image.

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

the skill with ai is prepping the journey 1. base image for your character 2. character map for your character 3. gaze rig for your character if you try jumping to 3, that's the issue, you need good reference material, and a good model Krea + GPT 2.0 for this one 🤙

Profilbild von Occam’s Orange
Occam’s Orangevor 1 Monat

Thank you 🙏 I'm trying to make one for

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

ahh yes - you should be able to generate one for that little character 💯 try prompting for the prompts too my gaze rig prompt would start something like: 9x9 spritesheet head-rotation gaze rig for this character (map + basic images attached) and then i'll detail the angles

Profilbild von Occam’s Orange
Occam’s Orangevor 1 Monat

Got it. Thanks a ton! The character is my son. Gotta pay him royalist

Profilbild von 808
808vor 1 Monat

Damn thats clean! I love the double blink, adds so much depth. Will this be added sooner or later to the /index?

Profilbild von Mane
Manevor 1 Monat

Didn’t know you vibes with beavers like that

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

it's a gopher 🥲

Profilbild von John Cotterell
John Cotterellvor 1 Monat

The blinking is a really nice touch. I did something similar with this character. It is quite painstaking work doing it with a spritesheet.

Profilbild von Deepak
Deepakvor 1 Monat

If I could follow one fucking person on X it'll be you man, you're the fucking goat

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

whoah - appreciate that 💯🙏 doin' what i can to try and post a little more again. i've been trying to collect/curate all my work over the years into one spot on my site, it's been takin' a minute 🙇‍♂️

Profilbild von Deepak
Deepakvor 1 Monat

There's so much alpha in what you post, it's just an endless sea of knowledge. Thank you for your posts

Profilbild von yann · minimal design
yann · minimal designvor 1 Monat

Is that on Codepen somewhere? 😍

Profilbild von Allie Speers
Allie Speersvor 1 Monat

omg who is lil fella

Profilbild von jhey ʕ•ᴥ•ʔ
jhey ʕ•ᴥ•ʔvor 1 Monat

a little mascot i'm toying with for a project 😁

Profilbild von Simon
Simonvor 1 Monat

really cool

Profilbild von Crownz | AI & Design
Crownz | AI & Designvor 1 Monat

It does look fun

Profilbild von Joshua Ress, BSc
Joshua Ress, BScvor 1 Monat

I LOVE playing with spritesheets. Such a simple and effective trick

Profilbild von IGGYsosa
IGGYsosavor 1 Monat

Very very clever 👏 well done

Profilbild von Shubhu
Shubhuvor 1 Monat

how many images you generated for this one?

Profilbild von Nattu
Nattuvor 1 Monat

Thats some neat sprite management.

Profilbild von Anshuman
Anshumanvor 1 Monat

The explanation on this one is superb!!! 🤯🙌

Profilbild von Dzmitry Drynau
Dzmitry Drynauvor 1 Monat

Hmm, interesting and cool! I should try to do something like that on our platform.

Profilbild von Joseph Miclaus
Joseph Miclausvor 1 Monat

This is way too good... waaay too good.

Profilbild von Massdx
Massdxvor 1 Monat

how ? can you share a tutorial ?

Ähnliche Videos

CSS Trick 🧲 You can create magnetic links with the power of custom properties and some JavaScript 💪 a { translate: calc(clamp(-1, var(--x), 1) * var(--pad-x)) ...; transition: translate var(--s, 1s) var(--ease, var(--elastic)); } a:hover { --s: 0s; } The trick here is to pad out the list items wrapping your links and use that as a translation limit 🛑 Start by using some JavaScript to calculate a value between -1 and 1 for both the x/y axis on pointermove for each list item, not the link! 🔗 If your pointer was at the center of the item, you'd get [0,0]. If it was in the top right, you'd get [1,-1] ☝️ It's worth checking out the JavaScript snippet to see how the mapping function works. Essentially, you create a function that when given a value between two bounds, will give you a mapped value back 🤙 const mapX = mapRange( item.offsetWidth * -0.5, item.offsetWidth * 0.5, 1, -1 ) Then, on pointermove, you plug the pointer position in to get the value back out and pass that into your CSS const x = mapX(item.centerX - event.x) document​.documentElement​.style.setProperty(--x, x) When the pointer leaves the list item, you make sure to reset these values back to 0 ✨ Once CSS has your values, it's the trick of updating the translation of each part You know that in each axis, you only want to translate the link by the padding amount li a { translate: calc(clamp(-1, var(--x), 1) * var(--pad-x)) calc(clamp(-1, var(--y), 1) * var(--pad-y)); transition: translate var(--speed, 1s) var(--ease, var(--elastic)); } This will translate the link within the list item by the desired amount. The cool part here is that you can set an offset for the text inside the link and have that move at a different rate ⭐️ By only updating the --pad-x/y custom properties for the inside the link, you can control how much it moves nav a span { --pad-x: 0.25rem; --pad-y: 0.25rem; } And the last piece, how do you update the behavior for transition speeds? And so it springs back like that? Again, use custom properties ✨ a:hover { --s: 0s; } a { transition: translate var(--s, 1s) var(--ease, var(--elastic)); } By default, a link will use --elastic easing via linear() and have a transition-duration of 1s. When a link is hovered that speed becomes 0s because you want the link to magnetise to your pointer. How about that little gap between when your pointer enters the item but hasn't hovered the link? Set a different transition so it transitions to being hovered 🫶 nav li:hover a { --ease: ease-out; --speed: 0.1s; } That's kinda it! 🙌 Use JavaScript (~40 loc) to get the information and then let CSS do all the lifting for you 💪 Any questions or suggestions, let me know 🙏 If you want a walkthrough video, also let me know please 🙏 CodePen.IO link below 👇

jhey ʕ•ᴥ•ʔ

164,863 Aufrufe • vor 2 Jahren