You Need This Hover Effect on Your SVGs ASAP (ReactJS / TailwindCSS)

Поделиться
HTML-код
  • Опубликовано: 2 июн 2024
  • Watch as I show you how you can add a hover gradient to your SVGs, as seen on the Supabase landing page
    Follow me on Twitter: / rithmio
    ⏳ Timestamps
    00:00 - What we will build
    02:00 - Adding in content
    05:38 - The Hover Gradient
    👨‍💻 Looking for a web developer job, visit: www.webdevjobs.io/
    👽 Discord - / discord
    👾 Code - github.com/sixfwa/svg-gradien...
    #reactjs #webdevelopment #svg

Комментарии • 119

  • @iamrithmic
    @iamrithmic  Месяц назад

    You can find me on Twitter / X: twitter.com/rithmio

  • @Pixelaze
    @Pixelaze 2 месяца назад +43

    I'm calling it now, this channel is gonna blow up. Quality content.

    • @iamrithmic
      @iamrithmic  2 месяца назад +1

      Woah! Thank you!

    • @vinitgupta1648
      @vinitgupta1648 2 месяца назад +2

      I just saw this one video and I agree 💯

  • @meeko6692
    @meeko6692 Месяц назад +29

    Just a small remark - saving high velocity data into state, such as cursor position, will result in rather unpleasant performance because of the constant barrage or re-renders whenever you move your cursor. I personally would go with either setting those SVG attributes directly via JS in handleMouseMove or I’d use Framer Motion. Also getBoundingClientRect is kinda expensive and doing it in a mouse move handler will slow the whole thing down considerably. It’d be better to cache it (in a ref for example) and use it from there, since it doesn’t change that often…if ever.

  • @NIXO3D
    @NIXO3D 2 месяца назад +4

    This tutorial is GOLD. Thank you for sharing. 🍻

    • @iamrithmic
      @iamrithmic  2 месяца назад +1

      Glad you found it useful :)

  • @ardipranata6631
    @ardipranata6631 Месяц назад +1

    This channel is a national treasure fr, good & quality content

  • @carlosmorales8237
    @carlosmorales8237 18 дней назад

    Amazing, i have been wanting to do this effect for a while, thanks

  • @edt34
    @edt34 Месяц назад +2

    love it! thank you for this

  • @ericnemo8348
    @ericnemo8348 2 месяца назад +2

    Very nice ! Thanks for sharing !

    • @iamrithmic
      @iamrithmic  2 месяца назад

      Thanks for watching!

  • @thenightwolf224
    @thenightwolf224 2 месяца назад +5

    AMAZING KEEP GOING BUDDY

    • @iamrithmic
      @iamrithmic  2 месяца назад +1

      Thank you for the support!

  • @sandercafe
    @sandercafe Месяц назад +1

    Wow, simple and beauty! thx!

  • @neoney
    @neoney 2 месяца назад +6

    Would be nice if there was a constant preview of the browser window next to the code as you're adding classes, so it's easier to remember what which class does

    • @iamrithmic
      @iamrithmic  Месяц назад +1

      Will be trying this in future videos

  • @thehelldesk5463
    @thehelldesk5463 Месяц назад +1

    Thx for the share you gain one more subscriber. Great quality content.

    • @iamrithmic
      @iamrithmic  Месяц назад

      Thanks for the sub! Appreciate that a lot

  • @diogosoares1309
    @diogosoares1309 2 часа назад

    Masterclass 👏

  • @jamesonb5075
    @jamesonb5075 2 месяца назад +5

    I usually don't find youtube content useful, at all.. Buut.. This was very informative and straight to the point, it gets a thumbs up from me, well done!

    • @iamrithmic
      @iamrithmic  2 месяца назад

      Im really glad this was of use. Thanks for the comment!

  • @msahu2595
    @msahu2595 2 месяца назад +2

    Love the video ❤😍😘

  • @DomskiPlays
    @DomskiPlays Месяц назад +1

    Really cool!

  • @Stephinmaju
    @Stephinmaju 2 месяца назад +2

    Absolutely gorgeous 🥰

  • @mcstephen
    @mcstephen Месяц назад +2

    You just got a new follower

  • @r4rbit
    @r4rbit Месяц назад

    I've been wanting to share what I've learned through RUclips videos too but never find the courage to do so.
    What did motivate you to post videos like this one? You make it look easy, great job!
    This was very informative and enjoyable 👍🏻

  • @YashTiwari.official
    @YashTiwari.official 2 месяца назад +1

    Hey brother please start a series on Three js you are amazing on that ❤🎉

  • @sid4579
    @sid4579 2 месяца назад +3

    Jeeez the quality

    • @iamrithmic
      @iamrithmic  2 месяца назад

      Thanks! Trying to improve with each video

  • @michaelkurzewski2937
    @michaelkurzewski2937 Месяц назад +1

    This could be great for bento box gradient borders. Just create svgs wrappers with composed children inside. I think it's just a bit of calculating for it to be dynamic size

  • @Sammysapphira
    @Sammysapphira Месяц назад +1

    I smell a new web design trend

  • @AlexLamper
    @AlexLamper Месяц назад +1

    How did you even edit this video, and what program did you use for it? Looks crazy good bro. Also, very interesting video!

    • @iamrithmic
      @iamrithmic  Месяц назад

      Thank you! I used Premiere Pro

  • @mohitashliya8750
    @mohitashliya8750 2 месяца назад +2

    Finally some good knowledge using tailwind

  • @SolidWorksMastery-hr4sg
    @SolidWorksMastery-hr4sg 17 дней назад

    Thanks for the video it's great .... i was trying to replicate also the effect on the 'supabase' website in the "edge function" card the effect that look like an electricity passed or something ... i also see it in vercel website it's so nice but i think i should learn more on animation and svg before i can make it

  • @HarshilChaurasiya
    @HarshilChaurasiya Месяц назад +1

    which extension do you use for that equal sign and arrow sign??

  • @beehivenetwork2099
    @beehivenetwork2099 24 дня назад

    Ok, thanks a lot. Now, how do I build it in plain JS?

  • @farzadmf
    @farzadmf 2 месяца назад +3

    Really cool! Would be nice if you shared the code in a repo or something

    • @iamrithmic
      @iamrithmic  2 месяца назад +2

      Thanks man, lol yeah will be adding it!

    • @farzadmf
      @farzadmf 2 месяца назад +2

      Great, thank you!

    • @iamrithmic
      @iamrithmic  2 месяца назад +2

      It's there mate :)

    • @farzadmf
      @farzadmf 2 месяца назад

      Great!

  • @user-dp6vz9vw7c
    @user-dp6vz9vw7c 2 месяца назад +1

    good tuto brother , but i have a question : how do i deal with big svg in nextjs

    • @iamrithmic
      @iamrithmic  2 месяца назад

      Thank you! The same way, however I would keep an eye out on the viewbox property with SVGs etc. You may have to play around with some values, however the principle shown in this vid would be the same

  • @r-i-ch
    @r-i-ch 2 месяца назад +1

    This is a great effect and code explanation but I can’t help but feel it is a messy mix of techs and concerns.
    I think taking Tailwind out of the equation could clear things up. Ditto for using pure JS instead of react states.
    (Ex. You could activate the svg border with a :hover pseudo-class)
    Still. Hella cool.

    • @iamrithmic
      @iamrithmic  Месяц назад +1

      I should have stated, i think supabase also uses tailwind on their landing page. But thank you :)

    • @r-i-ch
      @r-i-ch Месяц назад

      @@iamrithmic Well then it looks like I gotta have a talk with someone at Supabase 😁
      That's the nature of Dev - plenty of ways to do the same thing.
      (Plus I will always admit to disliking Tailwind)
      I'll have to find, I think Kevin Powell did something like this in pure CSS maybe🤔. To be continued...
      Thanks again for great work and inspiration.

  • @holypizza1
    @holypizza1 Месяц назад +1

    How come that I never discovered your channel before?

  • @febrisapermana
    @febrisapermana 2 месяца назад +1

    what theme do you use in your VSCode ?

    • @itszbari
      @itszbari 2 месяца назад +1

      Look like material ocean dark (material community theme)

    • @iamrithmic
      @iamrithmic  2 месяца назад +1

      Correct :)

  • @_BonsaiBen
    @_BonsaiBen Месяц назад +1

    you should see Vercel's 2024 annual conference page...!!!!

  • @ralusek
    @ralusek Месяц назад

    Here's what I'd change:
    1.) This is just semantic, but I'd change the interface of the Flame component to be more agnostic about what is determining where it draws the gradient. Sure, it could be the cursor, but it could also be animated for another reason. Just have it accept gradientCenterX and gradientCenterY rather than implying it should have to do with cursor. Likewise, rather than accepting mouseOnCard prop, which makes it now have assumptions about its parent and where the Flame component will be used, it'd make more sense to just have it have a prop called showGradient
    2.) Rather than having gradientCenter/setGradientCenter and the accompanying useEffect inside of Flame, if there's a calculation like that that you need to do, just replace both with a useMemo.

    • @varunchakraborty6020
      @varunchakraborty6020 Месяц назад

      relatively new in this field and kinda confused of memoization stuff, but what's the point of memoization of the result when cause of animation keeps on changing and so does the input to calculations?

    • @ralusek
      @ralusek Месяц назад

      @@varunchakraborty6020 He's currently running it in a useEffect hook which is also reacting to the changed input. useMemo is just taking his useState/useEffect and combining them to a more semantically correct representation of his goal. With regards to why you'd memoize in the first place, you're right that the input here will change frequently enough such that many of these cases in which it would be memoized will trigger a rerun for a changed input, but there are plenty of times which react might call a re-render with the input having been unchanged. For example, as a user is typing something, they're not moving the cursor but the renders are happening, this memoization would hold in those cases. React also often renders a few times while squaring away its render state with some other underlying state, and those redundant renders need not recalculate the effect, as the cursor will also have the same position in those cases. But in general, I'd say your intuition is on the right track.

  • @daleryanaldover6545
    @daleryanaldover6545 Месяц назад +1

    vight innit 😭

    • @iamrithmic
      @iamrithmic  Месяц назад +1

      😂 forever conscious of this. was just waiting for someone to pick this up

  • @marcusalx
    @marcusalx Месяц назад +1

    It's pronounced "veet"! :) Nice video!

  • @NekoujiTV
    @NekoujiTV Месяц назад

    hmm... it possibly do same effect on text overlay?

  • @fricze
    @fricze Месяц назад +1

    fajne

  • @AjaySingh-jz8qx
    @AjaySingh-jz8qx Месяц назад +1

    Amazing

  • @naylord5
    @naylord5 2 месяца назад +4

    Sweet baby Jesus, you missed the NSFW tag here mate, this is too sexy 🔥
    Thank you so much for sharing!

    • @iamrithmic
      @iamrithmic  2 месяца назад

      Haha thank you! Glad you found it useful :)

  • @YassineDorgaa
    @YassineDorgaa Месяц назад

    can i applied on card or something semilair to png .. etc

    • @iamrithmic
      @iamrithmic  Месяц назад +1

      Would have to be an SVG

  • @Stephinmaju
    @Stephinmaju 2 месяца назад

    What is the Name of the code theme?

  • @SjarMenace
    @SjarMenace Месяц назад

    How do you know all this code out of your head dang

  • @ariphharts
    @ariphharts Месяц назад +1

    Why does this feel like Hyperflex's style

    • @iamrithmic
      @iamrithmic  21 день назад

      My favourite RUclips channel. A lot of inspiration from him

  • @osiralon
    @osiralon Месяц назад

    "Too smooth" means "so smooth its a bad thing".

  • @Sanatani_AyushEdit
    @Sanatani_AyushEdit Месяц назад

    Ezsnippet army like 👍

  • @babayaga5848
    @babayaga5848 Месяц назад

    i find this very complicated, dev is hard for me :(

  • @xbsidesx
    @xbsidesx 2 месяца назад

    Why use that @apply instead of just using class name? If you want that as a component, just do a component, not a class with @apply. It’s counterintuitive and not recommended by tailwind.

    • @muslehuddin8847
      @muslehuddin8847 2 месяца назад +1

      Reusable className

    • @xbsidesx
      @xbsidesx 2 месяца назад

      @@muslehuddin8847 not the case here, it's used literally once. Also, if in the future you need it to be reusable, just do a component, it'll be exactly that ;)

    • @erentr7167
      @erentr7167 Месяц назад

      @@muslehuddin8847 which tailwind doesnt suggests and warns you to not to do that because whole point of tailwind is to get rid of class names.

  • @vulbyte
    @vulbyte Месяц назад

    neat way to do so, but being real i feel like this is massively over coded.
    i would so something like (skipping most of the verbosity of code just to make it more concise):
    div: id=followMouse h=25%, w=25% clip:svgOutline
    then just have a js loop that lerps the xy of the mouse. this way you can also just apply it to every and any element on the page.

  • @ImTheDot
    @ImTheDot 9 дней назад

    .

  • @morespinach9832
    @morespinach9832 Месяц назад

    Goodness. Tailwind is one of the worst things to happen to CSS. With the tag spaghetti. Any proper css way to achieve this?

  • @erentr7167
    @erentr7167 Месяц назад +4

    too many states, too many use effects bro. also you use a ref. you dont need to use that many hooks. you also pass them as props. dont do that. just use a single state with single event listener. you do too much calculation on that function.

    • @erentr7167
      @erentr7167 Месяц назад

      also you hold cursor x y state in root component which it will rerender each time you move the mouse, it will rerender the whole application, not ideal sorry.

    • @rollotomasi1832
      @rollotomasi1832 Месяц назад

      It's clear that you just finished your first React tutorial. Leave the heavy lifting to the big boys.😂

    • @erentr7167
      @erentr7167 Месяц назад

      @@rollotomasi1832 I think its just 4th year of me with typescript & react bro

  • @Bodom1978
    @Bodom1978 Месяц назад +17

    Would have been better without React or Tailwind.

    • @schuste6
      @schuste6 Месяц назад +1

      why?

    • @vaccariaofsamsara
      @vaccariaofsamsara Месяц назад

      why? care to explain?

    • @Bodom1978
      @Bodom1978 Месяц назад +8

      Because if this tutorial was done using native JS and CSS it would be useful to anyone regardless of the frameworks they do or do not use.

    • @schuste6
      @schuste6 Месяц назад +1

      @Bodom1978 is there something wrong with using them? im actually curious because i thought react, tailwind, etc are solid frameworks and they make it easier to create things. also they have more features

    • @Bodom1978
      @Bodom1978 Месяц назад +4

      There is nothing wrong with using them, I use them a lot, but I also have many projects that do not. A tutorial with native JS and CSS would be easily ported to any framework. But the other way around limits it to only React and Tailwind.

  • @Euquila
    @Euquila Месяц назад

    10:40 let's take a moment to appreciate how useless typescript is in general

  • @dinoDonga
    @dinoDonga Месяц назад +1

    Somewhat reminds me of @Hyperplexed. Straigt up to the point and visually pleasing. Great stuff no pressure just keep doing your thing

    • @iamrithmic
      @iamrithmic  Месяц назад +1

      One of my biggest inspirations on YT. Comment means a lot!