Satisfying Black Fire Cursor Trail Animation

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2022
  • Learn how to create a cursor trail animations that follows the cursor based on the relative position of the mouse with HTML, CSS, JavaScript.
    Codepen: codepen.io/zainzafar/pen/oNypoEr
    Gradient Generator: www.learnui.design/tools/grad...
    Extra 🔥: People were curious on how to get that inverted effect I didn't include it as part of making it short so here's the version if you are interested in inverting colors
    Codepen (Inverted Color Effect): codepen.io/zainzafar/pen/KKejxQg
    #javascript #webdevelopment #codepen #animations

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

  • @vicentemoore5675
    @vicentemoore5675 Год назад +34

    Perfect Video!! but now i can't press buttons or select text, what should I do?? Its like if the Mouse isn't working

    • @codemorphism
      @codemorphism  Год назад +35

      By setting "pointer-events: none;" to .circle class should do the trick. Also updated codepen's CSS section, just in case you want to get an idea. Thank you for highlighting this.

    • @vicentemoore5675
      @vicentemoore5675 Год назад +5

      @@codemorphism thanks for the quick response friend! I appreciate your content

  • @anmolsharma4049
    @anmolsharma4049 Год назад +5

    You should have more than 150k subs. Your production quality is top notch

  • @svengunther7653
    @svengunther7653 3 месяца назад

    Thanks for sharing this. So cool!

  • @MariusLeica
    @MariusLeica Год назад

    Wow! Really nice effect! Thank you for the video!

  • @tofuboy529
    @tofuboy529 Год назад +2

    I love it! Nice and concise tutorial too ^^

  • @Kenshinwtw
    @Kenshinwtw 5 месяцев назад

    awesome video. clear and concise. gonna try and implement something similar to this on a project soon.

  • @fuggoff8236
    @fuggoff8236 Год назад +8

    Subscribed my dude. Tutorial is short and easy to follow. No unnecessary things.
    Keep up the good work.

  • @greendsnow
    @greendsnow 9 месяцев назад +1

    Svelte made me love watching Vanilla JS content because it's so easy to apply it with it.

  • @laes8564
    @laes8564 Год назад +2

    thank you very much! Great work!

  • @voldemortvi4264
    @voldemortvi4264 Год назад

    +1 sub , short explanation , nice music in the background & i learned few things thanks to you

  • @aryanpinto5105
    @aryanpinto5105 Год назад

    Thanks Man. The mouse trailer is really beautiful. Have implemented it in my portfolio. Once again thanx!!

  • @Fight011
    @Fight011 4 месяца назад

    thank you for your work, i was searching about custom cursors on websites, but i did'nt find any of them. then i searched on yt and here i found youuuuuuuuu!

  • @eybietie
    @eybietie Год назад

    really good video. inspirational and short. one client will soon have such a cursor :)

  • @sanskarsharma5863
    @sanskarsharma5863 Год назад

    A quick subscription just like the video 🙌

  • @shankarpubg9413
    @shankarpubg9413 8 месяцев назад

    Crazy one ❤

  • @AwaisAli93
    @AwaisAli93 Год назад

    It is amazing

  • @devamrh
    @devamrh Год назад

    Remember me dude. I subscribed😇
    BTW, this was a helpful tutorial and please make more like it.❤️❤️‍🔥

  • @FrankGP.com.
    @FrankGP.com. Год назад

    Perfect Video

  • @saadmounaime6856
    @saadmounaime6856 Год назад

    Perfect 👌🏼

  • @Andres-cc7vv
    @Andres-cc7vv Год назад

    Thank u.

  • @megamind452
    @megamind452 Год назад

    Subscribed & liked 👍

  • @developer_014
    @developer_014 Год назад +1

    Great content and really simple that ur simplicity and the way you highlights little things in ur video reminded me of a similar creator, Hyperplexed. Once again great content and you have successfully won my sub!

    • @codemorphism
      @codemorphism  Год назад +1

      this comment made my day, thank you 🙏

  • @charlesxavier77
    @charlesxavier77 Год назад

    you really need to make more video like this :D

  • @rayancodes4618
    @rayancodes4618 Год назад +2

    NICE WORK

  • @awebcode
    @awebcode Год назад

    wow great

  • @the_ere
    @the_ere 5 месяцев назад

    could you possibly ever make a app or program do the same thing so it dont not only work on a website?

  • @JYT-Official
    @JYT-Official Год назад

    I'm new here and i wonna subscribe just because of your quick response bro.

  • @chandruloganathan3725
    @chandruloganathan3725 10 месяцев назад

    How to use it in the react. Since I am having many components in my file I slightly confused on how to use this in react. Help me!

  • @hasiburrahman2132
    @hasiburrahman2132 8 месяцев назад

    Hi, Awsome tutorial.
    Wanted to ask something, how can we delay the cursor following?
    because I've created another simple small cursor and wanted this trailed cursor to follow that small cursor.
    Thank you.

    • @codemorphism
      @codemorphism  6 месяцев назад

      there’s .animate method that uses duration I believe and can help achieve the goal, I’ll try creating a code snippet that I can post the link for

  • @coderizer
    @coderizer Год назад

    looks so fun working on this kinda project

  • @chriatianngouw
    @chriatianngouw Год назад

    more like this plsss

    • @codemorphism
      @codemorphism  Год назад

      I have posted another video 2 days, I hope it fits the bill

  • @aniket_20.05
    @aniket_20.05 3 месяца назад +1

    Will it work on scrolling ?? 😢

  • @dhaneshvijayragu
    @dhaneshvijayragu Год назад

    Really nice video.. I wanted to implement this in react using framer-motion but the nextCircle thing is kinda difficult to do and I am clueless. Any help on how to get the next Circle's coordinates in react?

    • @codemorphism
      @codemorphism  Год назад

      I haven’t used framer motion but should be the logic

  • @charlesxavier77
    @charlesxavier77 Год назад

    very nice

  • @rickyventaglio5811
    @rickyventaglio5811 8 месяцев назад

    Bro, this is fantastic and exactly what I’m looking for. I’ve got a problem though. I’m using Webflow to build a site. How would I go about the injection of the code? Should I just create x amount of div blocks called ‘circle’?

    • @codemorphism
      @codemorphism  8 месяцев назад

      I haven't worked with Webflow, but this code should work on any site that supports HTML, CSS, and JS

    • @lifeofameji
      @lifeofameji 3 месяца назад

      hey bro, were you able to get it done on webflow?

  • @eddy3795
    @eddy3795 Год назад

    hey i love that cursor and i wanted to use it for obs on a scene where you cant see the regular cursor, do you have a e.g. python script for that or any other way to do this?

    • @codemorphism
      @codemorphism  Год назад

      I am sorry but I don’t get what you mean by python script for this?

    • @eddy3795
      @eddy3795 Год назад

      @@codemorphism for obs, open broadcaster software, but doesnt have to be a script

  • @TERIHAX
    @TERIHAX 9 месяцев назад

    The second hyperplexed

  • @sushmithanairws
    @sushmithanairws 6 месяцев назад

    Hello! I absolutely love this and want to add this to my framer website and was wondering if you could help me out with it.

    • @codemorphism
      @codemorphism  6 месяцев назад

      havent worked with framer but if it allows custom script/css and some html, you can get the link for code in description

  • @dabbopabblo
    @dabbopabblo Год назад +1

    You skipped the part where your supposed to use backdrop filter to invert whats behind it, and how would you stop it from inverting the other circles?

    • @codemorphism
      @codemorphism  Год назад +1

      Yeah that wasn’t in scope of the video but people liked so I created that too, it was in description, please check this out: codepen.io/zainzafar/pen/KKejxQg

  • @LewraAzad
    @LewraAzad Год назад

    Nice work dude!
    Remember to give me a thumbs up when you reach a million.

  • @user-cb5fg1fb2g
    @user-cb5fg1fb2g 4 месяца назад

    hey bro, this is soo interesting. Not working on elementor. can you please make a video for
    elementor users???

  • @hindibravenews
    @hindibravenews 8 месяцев назад

    Can you make cursor like this

  • @ayoolaniyi4594
    @ayoolaniyi4594 Год назад

    Great tutorial! I noticed an issue when I tried to use it on my site, it works well initially but when I scroll further down a long page the cursor doesn't follow the mouse down the page.

    • @codemorphism
      @codemorphism  Год назад

      Setting "position: fixed" should handle this for you, since it was tutorial on how to replicate the behaviour, I didn't account for scrolling page. Thank you for the catch.

    • @codemorphism
      @codemorphism  Год назад

      Here's the codepen with what you are looking for: codepen.io/zainzafar/pen/abKgBNX

    • @ayoolaniyi4594
      @ayoolaniyi4594 Год назад +1

      @@codemorphism Thank you! more of these tutorials would be really appreciated.

    • @watusi1988
      @watusi1988 11 месяцев назад

      @@codemorphism i have the same issue, position fixed doesnt solve it. what can i do?

    • @codemorphism
      @codemorphism  11 месяцев назад

      @@watusi1988 can you share the code or at least give me reproducible version-of the code?

  • @itstechking
    @itstechking 7 месяцев назад

    this is the only video i found to create this king of effect thanks for helping us.but when I tryed to run this on VS code it wont do anything.how can i fix it sir? (It is not working even when i just copy it from code pen)

    • @codemorphism
      @codemorphism  7 месяцев назад

      can you provide the link that reproduces the issue probably a sandbox link or something

    • @itstechking
      @itstechking 7 месяцев назад

      @@codemorphism unfortunatly i dont know how to do that but I can send you some screen shots of the code via Gmail is it fine?

  • @Xenodinger
    @Xenodinger Год назад

    You didn't add that inversing of colors feature when you go over items on the page, I added a few text elements and the circles were blocking me from seeing them

    • @codemorphism
      @codemorphism  Год назад

      I wanted to but that would kill the short video purpose.

    • @Xenodinger
      @Xenodinger Год назад

      @@codemorphism I get it, but props to you, I definitely subscribed, you’re going places man, at least your account is, because your content deserves better exposure

    • @codemorphism
      @codemorphism  Год назад +1

      @@Xenodinger No worries. There you go with inverted colors. Codepen: codepen.io/zainzafar/pen/KKejxQg

    • @Xenodinger
      @Xenodinger Год назад

      @@codemorphism Thank you very much, I know it will be harder for you to personally reply to comments as your channel grows, but I hope you keep up this energy

  • @Hamzahharoon
    @Hamzahharoon Год назад +1

    Why does it perfectly work on codepen, when i apply this effect on my own html, the first circle starts to cut off and looks unpleasant please let me know if anyone knows a way around this

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

    Why does mouse scroll not work

  • @lenamusatov3359
    @lenamusatov3359 Год назад

    Do you need a library for this? The .js part doesn't seem to be working with my html page, the dot stays at the upper left corner.

    • @codemorphism
      @codemorphism  Год назад

      I have shared the link in the description, it should work out of the box, no library is required to run this

    • @lenamusatov3359
      @lenamusatov3359 Год назад

      @@codemorphism Wouw thank you for the quick respose! I tried with the code from the description but it still doesn't seem to work. I get an error saying "uncaught type error: cannot read properties of null (reading 'style')" refering to line 47-48 in the js code.

    • @codemorphism
      @codemorphism  Год назад

      @@lenamusatov3359 are you sure you are using the correct class names both in html and js?

    • @lenamusatov3359
      @lenamusatov3359 Год назад +1

      @@codemorphism Omg It works now! I made a completly new file and tried again and it works now. I might have accedentally done something weird. But again thank you very much for your help and for the video! I realliy like this cursor effect, it's also so satisfying haha

  • @lean9875
    @lean9875 Год назад +4

    Very nice! I made some adjustments to make it run in react, I solved a problem that I had when clicking on other elements (all the other elements of my project have z-index: 100;), anyway if it helps someone here I leave the code:
    import React, { useEffect } from 'react';
    import './style.css'
    function MouseTrail() {
    useEffect(() => {
    const circles = document.querySelectorAll('.circle');
    const coords = {
    x: 0,
    y: 0,
    };
    circles.forEach(function (circle) {
    circle.x = 0;
    circle.y = 0;
    });
    const bg = document.createElement('div');
    bg.classList.add('bg');
    document.body.appendChild(bg); // Agregamos el div bg al body
    const animatedCircles = () => {
    let x = coords.x;
    let y = coords.y;
    circles.forEach(function (circle, index) {
    circle.style.left = circle.x - 12 + "px";
    circle.style.top = circle.y - 12 + "px";
    circle.style.transform = `scale(${(circles.length - index) / circles.length})`;
    circle.x = x;
    circle.y = y;
    const nextCircle = circles[index + 1] || circles[0];
    x += (nextCircle.x - x) *0.5;
    y += (nextCircle.y - y) *0.5;
    });

    }
    window.addEventListener('mousemove', (e) => {
    coords.x = e.clientX;
    coords.y = e.clientY;
    animatedCircles();
    });
    }, [])
    return (

    {/* Agregamos el div bg en el renderizado */}











    );
    }
    export default MouseTrail;
    style.css :
    .circle{
    height: 24px;
    width: 24px;
    border-radius: 24px;
    background-color: azure;
    position: absolute;
    top: 0;
    left: 0;
    mix-blend-mode: difference;
    z-index: 0;
    }
    .bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1000;
    }

    • @lean9875
      @lean9875 Год назад

      I have another problem, when I scroll the "Mouse Trail" it stays away from the cursor :(

    • @lean9875
      @lean9875 Год назад +1

      Fixed, literally 🤣 style.css = .circle {
      position: fixed
      }

    • @aryanpinto5105
      @aryanpinto5105 Год назад +1

      Thanx bro. Your code was of great help to me.

  • @herosova
    @herosova Год назад

    why it always happen the thing i have built 2 years ago now youtube recommends me hey see this

  • @digitalspsrconstructions
    @digitalspsrconstructions Год назад +1

    what about that effect when cursor is not moving ...the effect in its static form

  • @al-ggames1269
    @al-ggames1269 9 месяцев назад

    Do you have a video on doing this with react?

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

      It's literally the exact same bro

  • @watusi1988
    @watusi1988 11 месяцев назад

    hi! I have a bug, that when i scroll down in the website, the default mouse and the animated mouse are separated, how can i fix that?

    • @watusi1988
      @watusi1988 11 месяцев назад +1

      I have resolved issue using pageX and pageY insted of clientX and clientY.

    • @codemorphism
      @codemorphism  10 месяцев назад

      thanks for updating

  • @hammerhammer-wn8rn
    @hammerhammer-wn8rn 11 месяцев назад

    does it work or is it just for the site bc im looking for a cursor and this showed up

    • @codemorphism
      @codemorphism  11 месяцев назад

      site only ofc

    • @hammerhammer-wn8rn
      @hammerhammer-wn8rn 11 месяцев назад

      @@codemorphism sorry bc my friend send it wasnt site only

  • @t.g6231
    @t.g6231 Месяц назад

    How do I download this and make it my pc's mouse cursor trail

  • @AjayShree29
    @AjayShree29 Год назад

    Just grt tutorials bro...i thing that i wann remove mouse arrow from circle.. i mean its works fine but circle display with arrow cursor so i wanna remove that display only circle.

    • @codemorphism
      @codemorphism  Год назад +1

      This line (👇🏻) should get you going
      * { cursor: none; }

    • @AjayShree29
      @AjayShree29 Год назад

      @@codemorphism thank you so much....plz keep on posting these types of content.

  • @arjayquidlat
    @arjayquidlat 6 месяцев назад

    Damn I don't know why but my mouse animation moves only horizontal and not vertical :'( Help!

    • @codemorphism
      @codemorphism  6 месяцев назад

      Technically it shouldn’t, are you changing both x and y?

  • @bogdan_golubovic
    @bogdan_golubovic Год назад +1

    100 subs :)

  • @kushaljaindance2414
    @kushaljaindance2414 Год назад

    What's that software

    • @codemorphism
      @codemorphism  Год назад

      What do you mean by whats that software? Are you talking about codepen.io

  • @0lange
    @0lange Год назад

    How would you implrmrnt this in react?

    • @codemorphism
      @codemorphism  Год назад

      Not that I can’t implement but have you tried asking Chat GPT?
      As the logic remains the same it’s just a library change

    • @0lange
      @0lange Год назад +1

      @@codemorphism I figured it out :)

  • @djon.petitjean
    @djon.petitjean Год назад

    Can it be add to wordpress elementor ?

    • @codemorphism
      @codemorphism  Год назад

      haven’t played with elementor, PS its vanilla JS and CSS if elementor allows that you to do that should be fine so you’ll have to try it out yourself

    • @djon.petitjean
      @djon.petitjean Год назад

      @@codemorphism ok i will try thanks

  • @hey_im_abhi___
    @hey_im_abhi___ 10 дней назад

    can i get the source code of this Black Fire Cursor video???

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

      you can use codepen link shared in the description

  • @xyzshoaib3759
    @xyzshoaib3759 7 месяцев назад

    It is not working on my html file (vs code)?

    • @codemorphism
      @codemorphism  7 месяцев назад

      You can checkout the codepen link shared in the description

    • @xyzshoaib3759
      @xyzshoaib3759 7 месяцев назад

      yes I seen it but dosent work please help me sir @@codemorphism 😢

  • @tyoufi2085
    @tyoufi2085 Год назад

    how can i use the cursor?

  • @hammerhammer-wn8rn
    @hammerhammer-wn8rn 11 месяцев назад

    if it does work how do i get it bc i have the zip

    • @codemorphism
      @codemorphism  11 месяцев назад

      what do you mean you have a zip? I am not following

    • @hammerhammer-wn8rn
      @hammerhammer-wn8rn 11 месяцев назад

      @@codemorphism i mean is it possible to apply it to actual pc

  • @exouw
    @exouw Год назад

    it's not working for me at all =( but i'm not good at coding

    • @codemorphism
      @codemorphism  Год назад

      check this link: codepen.io/zainzafar/pen/abKgBNX and try following tutorial with detail code in the link

  • @one00000
    @one00000 4 месяца назад

    ruclips.net/video/DcUGqBXGaN4/видео.html
    How can this mouse run in the background?

    • @codemorphism
      @codemorphism  4 месяца назад

      that’s a desktop app but can be achieved via WebGL in web as well

  • @ezkymos
    @ezkymos Год назад

    Your outro content hide the final code you edited 👎

    • @codemorphism
      @codemorphism  Год назад

      I have completely removed the outro, thanks for pointing it out

  • @FourtyTwoShorts
    @FourtyTwoShorts Год назад

    when I refresh the page then the mouse is stuck in the top