正在加载视频...

视频加载失败

Future CSS Tip! 🍏 You can combine scroll-driven animations with background-clip to create gradient text reveals 😍 p { animation-name: move-bg, fade-in; animation-fill-mode: both; animation-timing-function: linear; animation-timeline: scroll(root); animation-range: 0 100vh, 40vh 100vh; } /* Multiple animations with shared timeline and different ranges 👀 */ keyframes move-bg { to...

180,112 次观看 • 2 年前 •via X (Twitter)

32 条评论

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Here's that @CodePen link! 🤙 Remember you need to be in Chrome 115+ to see this working ✨ Got a cool one for ya tomorrow! Now gonna go celebrate with my new wife 😍

Moescape AI 的头像
Moescape AI1 年前

Sign up & create wholesome anime art on Moescape AI now!

Jacek Smolak 的头像
Jacek Smolak2 年前

You should create an index of all of your creations, tagged, with easy searchability features. Unless you already have ;)

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Kinda got something in the works for this. It would be cool if there was some kind of @CodePen API. I'd love to be able to say "Grab all pens from jh3yy with the tag for-blog" or something 🙏 I have been adding the "popular" posts to my "Highlights" tab as I go but need to remember to do it. Also, got articles coming on some of these that have been shared recently! ✍️

Brian Poblete 的头像
Brian Poblete2 年前

Hi jhey! This looks amazing! Would it be alright for me to try and put this implementation into a package/ library that can be easily imported and customized? I'll include credit of course.

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Hey Brian 🤙 That sounds cool. How would you see that working? I do have a little thing that I've been piecing together that leans into custom properties. But, as it's wedding week I haven't had as much time as usual 😅 I'm merely here to share my thought process and ideas. If that inspires you to try something out or make something, that's awesome 🙏

Ξdziu 的头像
Ξdziu2 年前

I’m thankful for you man. I’ve been looking for a good explanation on how to achieve this effect. 🔥

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

You're more than welcome Ed! 🙏 I'm always open to requests as well 🤙 This is a nice effect. Think there's likely some other ways to approach it too ✨

Naman 的头像
Naman2 年前

@oleg008 I love scroll timelines but this particular animation can be achieved with masking and sticky position without needing scroll timelines!

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

@oleg008 Your demo isn't working in Chrome as a heads up

Cyrus Zei 的头像
Cyrus Zei2 年前

oh that is nice !!!

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Apple jus' keep giving us scroll designs 😅

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

One of my favorite GIFs, hands down 💯😅

freddie 的头像
freddie2 年前

wow that’s incredible! 2023 is surely the year of css. Cannot wait for mainstream support

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

@fredoiq Right?! Definitely a game changer API 💯

Artem Korenevych 的头像
Artem Korenevych2 年前

Does it works with current major version of Chrome, FF, or Safari? Or just an experiment mode in Canary?

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Stable Chrome since 115 🤙

Danny Moerkerke 的头像
Danny Moerkerke2 年前

Dude, you’re killing it, amazing! 👏👏👏

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Doing what I can to share my thought process 🙏 Thanks Danny! 🤙

❮λ❯ Elefunc 🌐 的头像
❮λ❯ Elefunc 🌐2 年前

👋🏻 You are all hereby invited to 🎁 build better with ↓ ⚡️ see your changes in real-time ⌨️ adjust numbers with ↑↓ keys ⋯ no waits/no reloads Swap codepen .io /⋯/pen/⋯ with ↓

Michelle Bakels 的头像
Michelle Bakels2 年前

this is sick 🔥

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Almost Inter Miami colors 👀😅 Thanks Michelle 🙏

Jason Kwok 的头像
Jason Kwok2 年前

Please, I just wanna read the info 😭. I don't wanna play a maze game.

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

Tell Apple Jason 😅

mrtksn 的头像
mrtksn2 年前

The irony of imitating Apple's design to work only on Chrome. Welcome to the era of neo-Internet Explorer where you need to download a specific browser to have the website display correctly.

jhey ▲🐻🎈 的头像
jhey ▲🐻🎈2 年前

It's an official CSSWG spec, it'll be in Safari sooner or later 🤙

Seppe Beelprez 的头像
Seppe Beelprez2 年前

@SaveToNotion

Rykelabs 的头像
Rykelabs2 年前

Wicked cool

Kelvin Ohemeng 的头像
Kelvin Ohemeng2 年前

At this point we need a course on how you make these CSS based scroll animations. 🙏

Jens Mourinho 的头像
Jens Mourinho2 年前

Hello, How would this be done with JS (react). Do you have an example?

Ben Warner 的头像
Ben Warner2 年前

@uxlinks @SaveToNotion

Ricardo Pimentel 的头像
Ricardo Pimentel2 年前

I might use this, looks awesome.

相关视频

CSS Trick! ⚡️ You can use scroll-driven animation with background-attachment to create a dynamic glowing card scroller without JS 🔥 section { animation:vibe; animation-timeline:--list; } @​keyframes vibe { to{--hue:320;}} .glow {background: hsl(var(--hue) 80% 50%);} Here's how! 🤙 You can use the background-attachment trick used in other glow card demos 😎 article { background-attachment: fixed; } The difference here is that you aren't going to update the fixed background position with your pointer this time. It can remain fixed. The magic part is that as you scroll, the background will leave the card that's leaving and enter the card that's entering ✨ For the extra background glow, you can use a fixed pseudo element on the list container itself 💪 Once that's in place, you're only task is to change the color of the background as you scroll 🤔 Create a custom property declaration for the --hue @​property --base { inherits: true; syntax: ' '; initial-value: 0; } Then create an animation that updates this value @​keyframes accent { to { --hue: 320; }} The last piece is hooking it up to scroll and there is a little trick in here 👀 First, you need an inline scroll-timeline on the list ul { scroll-timeline: --list inline; } Then you can use timeline-scope to hoist that scroll-timeline up so a parent can use it. You then animate the custom property on this element and let the value cascade down to the places that need it 🔥 section { timeline-scope: --list; animation: accent both linear; animation-timeline: --list; } For example, the glow uses the --hue this way [data-glow] { background-image: radial-gradient( 150px 150px at 50% 50%, hsl(var(--hue) 100% 70% / 0.25), transparent ); } Lastly, scroll-snap is optional of course but plays nice with the scroll-driven animation demos ✨ The key for that is ul { scroll-snap-type: x mandatory; } li { scroll-snap-align: center; } That's it! Pretty fun trick to play with! 🤓 Any questions, let me know! Should we add it to the video walkthrough list? CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

116,462 次观看 • 2 年前

CSS Trick! 🤙 You can create gradient borders on translucent elements using mask-clip and mask-composite with a pseudo-element 🔥 .gradient-border::after { mask-clip: padding-box, border-box; mask-composite: intersect; mask: linear-gradient(transparent, transparent), linear-gradient(white, white); } It's the same "Transparent border trick" from before. But, now you apply it to a pseudo-element 😎 The trick is to create a pseudo-element with a gradient background and then mask it so we only see the part we want, the border ✨ mask-clip defines the area affected by a mask. Similar to how you can define background-size. Using padding-box and border-box constrains the two masks. mask-composite is the magic part ✨ It defines a compositing operation for stacked mask layers. Using intersect means that the parts that overlap get replaced. And this seems to work in all browsers 🙌 As for the rest of the styles... – Make sure you set pointer-events: none on the pseudo-element – Make sure it fills the parent element. You can use position: absolute and inset: 0 – Make sure the background fills the space including the border-width. You can use calc to achieve that: --bg-size: calc(100% + (2px * var(--border))); background: var(--gradient) center center / var(--bg-size) var(--bg-size); That's it! 🚀 Gradient borders on translucent elements. You can set all the backdrop-filter: blur() you like! 😅 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

269,739 次观看 • 2 年前

CSS Tip! 🐳 You can add little details like this scale down on scroll effect with scroll-driven animations and some sticky positioning 🤙 section { animation: scale-down; animation-timeline: view(); animation-range: exit; } @​keyframes scale-down { to { scale 0.8; } ] In this smaller example, you can lean into using the position to drive an animation that scales itself down as it leaves the viewport (Seen on the Apple Vision Pro site 🍏) The nice thing here is that if you don't have scroll-driven animations, the user still gets a good experience ✨ So how do you do it? There isn't much to it header { transform-origin: 50% 0%; animation: scale-down both ease-in; animation-timeline: view(); animation-range: exit; view-timeline: --header; } @​keyframes scale-down { to { scale: 0.8 0.8; } } That's it. The layout makes use of position: sticky so that the element stays in the shot whilst you scroll the page. As it leaves the page, it scales down inside the 🫶 The other smol animation here is fading the overlay on the video out 😎 Real easy. You may notice the view-timeline you defined above for the 👀 header { view-timeline: --header; } You have a pseudoelement on the text content of the header that lives inside a header > section::before { background: hsl(0 0% 0% / 0.75); opacity: 1; animation: fade both linear; animation-timeline: --header; animation-range: exit-crossing 0% exit 0%; } @​keyframes fade { to { opacity: 0; } } You use a slightly smaller range on this with exit-crossing to fade it out before you start the scale down animation 🤏 That's it! Thought this smaller example would be easier to grok for people 🙏 It's also covered with JavaScript if you really want it for your sites 🤙 CodePen.IO link below 👇

jhey ʕ•ᴥ•ʔ

146,064 次观看 • 2 年前

CSS Tip! 💫 You can create this responsive perspective warp animation with 3D CSS and container queries ✨ (Video reveals trick 👀) .warp { container-type: size; perspective: 100px; transform-style: preserve-3d; resize: both; overflow: hidden; } Couple of tricks in this one 🤓 The main idea is to create a tunnel (an open-ended cube). On each side of the tunnel, use linear-gradient to create the grid lines ✨ .side { background: linear-gradient(#​fff 0 1px, transparent 1px 5%) 50% 0 / 5% 5%, linear-gradient(90deg, #​fff 0 1px, transparent 1px 5%) 50% 50% / 5% 5%; } To position each side, you rotate on the x-axis by 90deg. Each side would become invisible at this point. So you give the scene perspective 😉 .warp__side--top { width: 100cqi; height: 100cqmax; transform-origin: 50% 0%; transform: rotateX(-90deg); } The cool part here is that you want to make each side the same height. But the container is responsive. So you can use a container query and make sure each side is 100cqmax tall 🫶 Then the "beams". Each side contains "beams". They have different colors, sizes, and positions, and move at different speeds ⚡️ We can control that through scoped custom properties. .beam { width: 5%; position: absolute; top: 0; left: calc(var(--x, 0) * 5%); aspect-ratio: 1 / 2; background: linear-gradient( hsl(var(--hue) 80% 60%), transparent ); translate: 0 100%; animation: warp calc(var(--speed, 0) * 1s) calc(var(--delay, 0) * -1s) infinite linear; } The magic here is though that a beam's animation is as basic as translating it from the top of the side to the bottom. And you can get that distance with a container query again 🔥 @​keyframes warp { 0% { translate: -50% 100cqmax; } 100% { translate: -50% -100%; } } And that is pretty much it! A cool warp animation effect using 3D CSS and container queries ⚡️ If you have any questions, let me know ᵔᴥᵔ CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

187,474 次观看 • 2 年前