Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

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 Aufrufe โ€ข vor 2 Jahren โ€ขvia X (Twitter)

32 Kommentare

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

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 ๐Ÿ˜

Profilbild von Moescape AI
Moescape AIvor 1 Jahr

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

Profilbild von Jacek Smolak
Jacek Smolakvor 2 Jahren

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

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

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! โœ๏ธ

Profilbild von Brian Poblete
Brian Pobletevor 2 Jahren

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.

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

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 ๐Ÿ™

Profilbild von ฮždziu
ฮždziuvor 2 Jahren

Iโ€™m thankful for you man. Iโ€™ve been looking for a good explanation on how to achieve this effect. ๐Ÿ”ฅ

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

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 โœจ

Profilbild von Naman
Namanvor 2 Jahren

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

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

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

Profilbild von Cyrus Zei
Cyrus Zeivor 2 Jahren

oh that is nice !!!

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

Apple jus' keep giving us scroll designs ๐Ÿ˜…

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

One of my favorite GIFs, hands down ๐Ÿ’ฏ๐Ÿ˜…

Profilbild von freddie
freddievor 2 Jahren

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

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

@fredoiq Right?! Definitely a game changer API ๐Ÿ’ฏ

Profilbild von Artem Korenevych
Artem Korenevychvor 2 Jahren

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

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

Stable Chrome since 115 ๐Ÿค™

Profilbild von Danny Moerkerke
Danny Moerkerkevor 2 Jahren

Dude, youโ€™re killing it, amazing! ๐Ÿ‘๐Ÿ‘๐Ÿ‘

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

Doing what I can to share my thought process ๐Ÿ™ Thanks Danny! ๐Ÿค™

Profilbild von โฎฮปโฏ Elefunc ๐ŸŒ
โฎฮปโฏ Elefunc ๐ŸŒvor 2 Jahren

๐Ÿ‘‹๐Ÿป 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 โ†“

Profilbild von Michelle Bakels
Michelle Bakelsvor 2 Jahren

this is sick ๐Ÿ”ฅ

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

Almost Inter Miami colors ๐Ÿ‘€๐Ÿ˜… Thanks Michelle ๐Ÿ™

Profilbild von Jason Kwok
Jason Kwokvor 2 Jahren

Please, I just wanna read the info ๐Ÿ˜ญ. I don't wanna play a maze game.

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

Tell Apple Jason ๐Ÿ˜…

Profilbild von mrtksn
mrtksnvor 2 Jahren

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.

Profilbild von jhey โ–ฒ๐Ÿป๐ŸŽˆ
jhey โ–ฒ๐Ÿป๐ŸŽˆvor 2 Jahren

It's an official CSSWG spec, it'll be in Safari sooner or later ๐Ÿค™

Profilbild von Seppe Beelprez
Seppe Beelprezvor 2 Jahren

@SaveToNotion

Profilbild von Rykelabs
Rykelabsvor 2 Jahren

Wicked cool

Profilbild von Kelvin Ohemeng
Kelvin Ohemengvor 2 Jahren

At this point we need a course on how you make these CSS based scroll animations. ๐Ÿ™

Profilbild von Jens Mourinho
Jens Mourinhovor 2 Jahren

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

Profilbild von Ben Warner
Ben Warnervor 2 Jahren

@uxlinks @SaveToNotion

Profilbild von Ricardo Pimentel
Ricardo Pimentelvor 2 Jahren

I might use this, looks awesome.

ร„hnliche Videos

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 Aufrufe โ€ข vor 2 Jahren

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 Aufrufe โ€ข vor 2 Jahren

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 Aufrufe โ€ข vor 2 Jahren

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 Aufrufe โ€ข vor 2 Jahren