Learn Creative Coding: Particle Systems

Поделиться
HTML-код
  • Опубликовано: 21 янв 2025

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

  • @Frankslaboratory
    @Frankslaboratory  Год назад +12

    Libraries or vanilla JavaScript, which one do you prefer to use.

  • @koko-mt7zr
    @koko-mt7zr Год назад +6

    I can’t believe you don’t have 1 million subscribers,keep up the good work you are amazing ❤❤

  • @chadbroderick160
    @chadbroderick160 Год назад +6

    Haven't even gotten halfway and this is already so incredible! Please never stop making these videos

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

      Glad you like it Chad. I will turn this into 10 very distinct generative art effects in the next parts

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

    Thanks a lot for your patience and explaining everything in such an understandable way. You are a great teacher.

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

    Awesome video. Just spend the last hour to follow through. Love your work!

  • @swedishpsychopath8795
    @swedishpsychopath8795 10 месяцев назад +1

    Hello Frank, and thank you for your excellent tutorials. I'm following along and made the base project and having a lot of fun with it. I started to visualize (on paper) the nested for-loop in the connectParticles function and noticed the following optimizations.
    1) The inner loop doesn't need to start on the value of the outer loop. This would be the same particle and there is no use in calculating the distance and drawing a zero length line to itself. Better start with the next particle (a + 1).
    2) The outer loop doesn't need to go all the way to the last particle since there are no more particle after it. So stop at len-1.
    Here is the optimized code:
    connectParticles(context) {
    const maxDistance = 100;
    for (let a = 0; a < this.particles.length - 1; a++ ) {
    for (let b = a + 1; b < this.particles.length; b++ ) {
    the-existing-code
    }
    }
    }

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

      I've dug further into the code and in ADDITION to the trick I showed in my original post (that avoids almost 30.000 calculations pr second - when avoiding to calculate the distance to itselt 60 times a second) it seems like it is ALSO better to do the math yourself instead of calling Math.hypot. I made a small test and timed the call to one million calculations of x and y with random numbers and run it multiple times in differenct browsers. It was definitelty more efficient to calculate the distance like this: const distance = Math.sqrt(dx*dx + dy*dy); (SO BASICALLY: DONT USE MATH.HYPOT !!!!)

    • @Frankslaboratory
      @Frankslaboratory  8 месяцев назад +1

      Hi, sorry I missed this comment, love it. thank you for taking the time to research and share this. I will test it and play with it as well when I have time over the weekend. Very interesting..

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

      @@Frankslaboratory It would be interesting if you could verify the first post? Personally I tried with a small amount of particles and the loop optimizations seemed to be correct (small number of particles to see if any were skipped). When it comes to using sqrt instead of hypot it seems the browsers do the math in the libraries differently (?). So I'm not definititely sure about how much longer hypot takes - but it seemed siginificant when testing with a large amount of particles. I was also avoiding using the pow function from Math. I did the dx*dx and dy*dy directly. So the first optimization makes room for having more particles since the CPU time can be spent calculating "real" disances instead of zero-distances. The other optimization is dependent on a lot of hidden optimization going on in the background. Maybe pow is inlined / replaced with multiplication anyways? Hope you'll let us know if you try this out?

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

    Great explanation and cool effects - thanks for this video!

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

    we love you ^^ , you teach us so much!

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

    omagaad King , you always put out some amazing video that fill my brain with good stuff ! I thank god you exist !

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

      Haha. Thanks for letting me know. Hope you like what I do with this effect in the next part then 😊

  • @my2ndpassionart
    @my2ndpassionart 7 месяцев назад +1

    Hey sir how can I use js particle effect & your image effect together in 1 HTML file , please help me

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

    Thanks for all your tutorials, brilliant as always.

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

    This is my favourite channel😊

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

    I'm hitting like for those bad ass glasses sir! (Also Frank, you rock! Thank you for your channel and fantastic projects.)

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

      Thank you Thomas, I'm happy to see feedback like that ☺️

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

    Never cease to blow my mind!! 🤯

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

      In that case you should see the 10 variations I will turn this into in this miniseries. I wonder what you will think then 😊

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

    at 9:45 I had to call the createParticles() function with "effect.createParticles()" and after tha console log effect. cuz the array kept being empty.

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

    Amazing, thank you so much for your videos!!!

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

    4 years ago i created same plexus art its available in my youtube channel but yours is way cooler 👌

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

    Great Video, really liked your way of explaining the code

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

      Thank you for your feedback. Glad you found some value

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

    Great! Thank you so much.

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

    excelente!!!, quisiera tomar tus cursos en udemy pero no tiene subtítulos en español y aun no soy bueno con el ingles

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

    thank you for this tutorial

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

    i just love what you do

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

    Amazing! Thanks for!

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

    Nice shades 🕶️🕶️😎

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

    A stupid question. Can I use the connectParticle method and change it so that each particle bounce off every other particle when they touch?

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

      Hi. Yes. You can put any code in there where you need check all particle pairs. I might do this as one of the bonus experiments.

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

      @@Frankslaboratory I came up with this
      if (distance < this.particles[a].radius + this.particles[b].radius) {
      this.particles[a].vx *= -1;
      this.particles[a].vy *= -1;
      this.particles[b].vx *= -1;
      this.particles[b].vy *= -1;
      }
      at the beginning I thought I had it but then I notice that is not quite realistic and I think it is because I am not considering the angle. hnmmm

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

      Also I am need to think of a solution so when I spawn a circle it can never be created inside the boundaries of another circle. I didn't know what I was in for when I started my own challenge. oh my!

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

      @Javi Fontalva if the circles repel each other it doesn't matter if they spawn inside each other. They will just pop outside. I didn that with eggs and mushrooms in my recent gamedev tutorial. Yes if you want realistic interactions you need circle collision resolution formula. I might do a video on that

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

    how i could use it as a website backround?

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

      Canvas element can be positioned on your website same as it was any other element

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

    Cool glasses :-)

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

      I'm sure you could track that neon colour around glasses and do some cool webcam video effects with that 😁

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

      @@Frankslaboratory Is that a challenge? :-D

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

      @@Radu yes 😁

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

      @@Radu I disabled my Twitter notifications. Will check when I get home 😊

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

      @@Frankslaboratory Sure :-)

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

    could you please share the code repo for this video; thank you!

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

      Yes i share the code for this in every episode of this series. When you get to the episodes with experimental projects i share the starter code from this episode there. Check the playlist

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

      @@Frankslaboratory thank you

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

    next please sir, cloth simulation😊

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

    I am wonder if instead of using straight lines we could use sines lines so it looks like electrical waves. The more I watch this videos the more ideas I come up with. The problem is how to go about it. 🤔

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

    🔥

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

    Very good videos I am amazed, where I can support you financially?

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

      You can always buy one of my extended classes on Udemy, I put some links on my About page here and under most videos. But there is no need, I'm happy to make most of my content free it's just for fun.

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

    Hi Frank how are you, particles videos are cool

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

    you are Goat was looking for code from scratch but everyone was using librarires

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

      All my videos are from scratch. No libraries at all. Have fun 😊😊

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

    thankyou :))

  • @koko-mt7zr
    @koko-mt7zr Год назад +1

    Can you do a video about a challenge between you and chatGPT

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

      Who do you think would win

    • @koko-mt7zr
      @koko-mt7zr Год назад

      100% you but do a video about that you know everybody is talking about it so it would make more people see your artwork and Chanel if you do a video about it

    • @koko-mt7zr
      @koko-mt7zr Год назад

      And about the fields video do you study calculus? It is about math and talks about fields if you want a good book about it I know some of them

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

    could you build a physics engine using javascript?

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

      Yes I will probably do more videos on physics next

  • @koko-mt7zr
    @koko-mt7zr Год назад +1

    And why you don’t go a step farther to 3 dimensional space?

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

    Please Frank, make a video on making a game like octopath traveller, specifically HD-2D effect... without 3D ☝😉 thank you for your contents

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

      Hi Khaled, I love that game, yes I would like to do something like that with JavaScript, probably just a smaller version otherwise it would be a 10 hour tutorial and people don't like when I make long videos here :D The effect itself wouldn't take that long, you mean the way characters are animated in that game yea?

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

      @@Frankslaboratory thank you very much, yes of course It should be a smaller version 🙂 I mean the visual effect that looks like a parallax map and the + the 8 directional animated mouvement of the character ... something like this ruclips.net/video/c9QmaCrT8Vk/видео.html ... but without 3d ... I think a clever implementation of parallax and light can achieve this... I will experiment if I get good enough but i wanted a well-versed dev like you to show us something 🤷🏾‍♂... have you ever done an rpg game on this channel ?

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

    so cool.. if only i know how to program

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

      That's why I made the video, to teach people how to do it :D

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

    🙏

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

    Hello Frank, I am a teacher. I want to build fun application for my website and pupils. Can I edit and use your code.

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

      Ho Abi. Yes you can go ahead and do that. Hope your students have fun learning

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

    🎉🎉🎉🎉

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

    please teach ai with javascript if possible