Coding Challenge #27: Fireworks!

Поділитися
Вставка
  • Опубліковано 20 вер 2024

КОМЕНТАРІ • 340

  • @Holobrine
    @Holobrine 5 років тому +260

    7:21 Origin of “this dot” song.

    • @kluplau
      @kluplau 5 років тому +7

      Holobrine Heard "Somebody compose this" and went to the comments to find out if this was the origin.

    • @piotrdanisz148
      @piotrdanisz148 4 роки тому

      De Staat :D

    • @gabrielaltwarg-peel7057
      @gabrielaltwarg-peel7057 4 роки тому

      So cool

    • @lelepao
      @lelepao 4 роки тому +1

      new drinking game: oneThisDot() {Return OneShot}

    • @2001herne
      @2001herne 4 роки тому +1

      @@lelepao Personal opinion for a better function name: onThisDot() { return oneShot}.
      Makes it seem a little more like an event handler.

  • @azvio8823
    @azvio8823 8 років тому +309

    Is it just me or is watching someone really good at coding really satisfying?

    • @joshuaadriaanse699
      @joshuaadriaanse699 7 років тому +7

      Azvio you're not alone bro. I love watching these videos

    • @marionikolov7798
      @marionikolov7798 6 років тому +6

      Azvio yeah, it makes me feel like I know programming

    • @PumpiPie
      @PumpiPie 6 років тому +10

      i get depressed sins i am never going to get that good xD

    • @EclipseKing52k
      @EclipseKing52k 6 років тому +1

      It's satisfying but am like god can ever get this good and how can I get this good.

    • @panunurmilaukas5519
      @panunurmilaukas5519 6 років тому +7

      He is actually quite bad.. I cant watch these videos without cringing.

  • @MagnoVJ10
    @MagnoVJ10 7 років тому +60

    The heart curve in function of "i" if someone is interested
    var x = 16 * pow(sin(i), 3);
    var y = 13 * cos(i) - 5 * cos(2 * i) - 2 * cos(3 * i) - cos(4 * i);
    Don't forget to invert "y" as "-y" once the y coordinate used in p5 is inverted in relation of what we use in math.

    • @utsavshrestha9725
      @utsavshrestha9725 7 років тому

      would you please elaborate a little, where am I supposed to put that code? :D

    • @MagnoVJ10
      @MagnoVJ10 7 років тому +4

      +Utsav Shrestha In this.explode function in Fireworks.js, when you pushing the 100 particles into this.particles. "i" is in the "for" that goes from 0 to 99 and then you use"i" in the equations and generate the x and y positions for each one of the particles.
      At least that's the best way I found for doing this. You can find your own. But the equations for x and y remain the same.

    • @kevinfox2413
      @kevinfox2413 6 років тому +1

      You would need to convert those to angles as it goes through the i values.

    • @Night4Blade
      @Night4Blade 6 років тому

      MagnoVJ10 щ

    • @ethanjensen661
      @ethanjensen661 6 років тому

      Utsav Shrestha those go in the vector!

  • @jorgeramos637
    @jorgeramos637 7 років тому +35

    im NOWHERE near being this good at coding. Lately ive lost my learning momentum. This video just pumped me 110% to keep going. Thank you so much!

    • @toastom
      @toastom 5 років тому

      I'm definitely there with you

  • @aniketmehendale
    @aniketmehendale 7 років тому +35

    I am binging all of these. Oddly satisfying category for me😛.

  • @2mbst1
    @2mbst1 8 років тому +139

    When you write "if(statement) {return true} else {return false};" you should rather write "return statement", boom ~4 lines saved.

    • @TheCodingTrain
      @TheCodingTrain  8 років тому +61

      yes, yes good point!

    • @nicolasmaniotto368
      @nicolasmaniotto368 7 років тому +4

      He could have written "return this.lifespan < 0;" at 22:05, right?

    • @2mbst1
      @2mbst1 7 років тому +5

      Correct!

    • @tonkamanage5799
      @tonkamanage5799 6 років тому

      What root directory are you using?

    • @sebastianmestre8971
      @sebastianmestre8971 6 років тому

      Another cool tip:
      If (statement){ return expression1}else{return expression2}
      Can be replaced with
      return statement ? Expression1 : expression2

  • @listen4159
    @listen4159 7 років тому +2

    I've always thought coding was cool, then this popped up into my news feed. This is now my 4th video ( my first was the rain one and the second one was the invaders one). I love your enthusiasm! Great videos ! keep it up!

  • @notuntrue8569
    @notuntrue8569 7 років тому +23

    14:00 and that's how you make the matrix

  • @Xfacta12482
    @Xfacta12482 7 років тому +10

    OMG I stumbled across the video with the birth of the this dot song

  • @joesharp3580
    @joesharp3580 6 років тому +1

    Love this one, fireworks was the first thing I tried myself when I discovered p5

  • @FJProject
    @FJProject 7 років тому +6

    There is not a bug with colorMode(HSB) !
    As in p5 reference says:
    By default, this is colorMode(HSB, 360, 100, 100, 1).
    So the alpha values must be between 0 and 1 or set the range explicitly.

  • @Wirelesstaco
    @Wirelesstaco 8 років тому

    Woo, Challenge complete! I'm challenging myself to do these challenges with you. I've been skirting around creative coding for years now and I'm finally digging in. Thank you for all of your content , enthusiasm and love for this work.

    • @TheCodingTrain
      @TheCodingTrain  8 років тому +2

      Thanks for watching! Share what you make!

  • @rtpHarry
    @rtpHarry 7 років тому +1

    Daniel you are using your powers for evil! Every time you name a variable badly and ignore best practices I feel myself becoming a slightly worse programmer, but you are just so entertaining I keep coming back for more! :)
    You should have split this up into more objects rather than creating the spaghetti code in this lesson.

  • @jjcya7607
    @jjcya7607 7 років тому +2

    Love the video! Managed to recreate this in Python using PyGame without too much trouble. Keep it up!

  • @modiddymo
    @modiddymo 7 років тому +1

    This has become my new favourite UA-cam channel

  • @gabrielaltwarg-peel7057
    @gabrielaltwarg-peel7057 4 роки тому +3

    Wow this channel is amazing. So fun to watch, very therapeutic and helps a lot with my own projects. Dan deserves all the thanks he gets and more for all of the inspiration. Thank you from us all!!!

  • @lopamudraghosh7475
    @lopamudraghosh7475 4 роки тому +1

    Another reason the JS version is slow could be because every particle and firework system has its own copy of show and update functions. Those can just be attached to the prototype chain instead.

  • @J12NBANews
    @J12NBANews 4 роки тому

    This is why I fell in love with coding! But still a beginner at JavaScript!

  • @eemelilehtonen8628
    @eemelilehtonen8628 7 років тому +4

    looks like you like coding, singing and dancing. i like coding, running and cubing

  • @tushargoyal8262
    @tushargoyal8262 5 років тому +1

    what a great challenge! learnt so many new things, class which is an object of another class. thanks Dan!

  • @ElBellacko1
    @ElBellacko1 3 роки тому

    Great lesson. I love video. Many of the concepts with vectors that you teach, you demonstrated in this video, which re-enforced me learning it.

  • @KhanhTheLearner
    @KhanhTheLearner 6 років тому

    I came here from the this dot song O.o and now I'm learning how to code!!! Coding is contagious...



    I love it!

  • @오가현-u9l
    @오가현-u9l 6 років тому +4

    this dot~ this dot~ this dot~~ i'll never forget this.

  • @CosteaMelniciuc
    @CosteaMelniciuc 7 років тому +1

    I am so inspired and amazed on how you're doing things! I really love your work.
    Btw subbed just a few days ago! Thank you very very much!

  • @m65917
    @m65917 7 років тому +1

    Great video ! I love the final version (3D). Might be interesting to get interested in "how to make particles (the rocket flying up) coming from random position, not only from 'the floor' " (you can see that all particles are flying up in the same direction)
    Great work. Subscribed (youtube and github)

  • @IronHeel
    @IronHeel 6 років тому

    Another great tutorial! I slowed Dan down to 0.75x and found it a little easier to follow along.

  • @LeRouxBel
    @LeRouxBel 8 років тому +1

    First of all, thanks to all the ones making This Dot songs. They are fantastic. I also wanted to recommend a new challenge to you Daniel. I worked out a "zoom out" system for a 2D representation of the solar system. Here is the source code : tinyurl.com/hvk5ld8
    Now I just thought, how about doing an "infinite" Fibonacci sequencer using that zoom system. As the spiral progresses, you simply scale things down to fit the screen, giving the impression of zooming out. Hope you find this interesting.

    • @TheCodingTrain
      @TheCodingTrain  8 років тому

      cool ideas! suggest here: github.com/CodingRainbow/Rainbow-Topics/issues

  • @kevinfox2413
    @kevinfox2413 6 років тому +14

    I changed the lifespan countdown from "-4" to "random(-1, 10)" and it makes them fade away much more naturally.

    • @alext1686
      @alext1686 5 років тому

      thanks for the idea :)

    • @Kitulous
      @Kitulous 5 років тому +1

      so you've made that there's a chance for particle to slightly light up instead of fading out?

  • @ncot_tech
    @ncot_tech 3 роки тому

    I'm glad this type of JavaScript was soon replaced by actual classes.
    Now, if they could fix the whole "this." nonsense everywhere, it'd be great.

  • @6754bettkitty
    @6754bettkitty 5 років тому

    The HSB thing is not a bug. It does not make sense for an HSB value to have an alpha, since the brightness would take care of that. With RGB, it makes sense to have the alpha.

  • @cn-ml
    @cn-ml 7 років тому +2

    26:32 I think it's not a bug... by default the max values for HSB color mode are: color(360, 100, 100, 1), so the alpha goes from 0 to 1 (and btw: also you gave this.hu a random value of random(255) where it should be random(360)... and yes, i know, i am a year late commenting on this)

    • @napatmaipaiboon9105
      @napatmaipaiboon9105 4 роки тому +1

      That's right. You need to set
      colorMode(HSB, 255, 255, 255, 255); instread of colorMode(HSB) inside setup function to work as the range he used.

  • @KristianPedersen
    @KristianPedersen 6 років тому +1

    You *can* actually forget the this dot if you use factory functions.
    Just look at this beautiful blob maker, free from any this dots:
    function Blob(x, y, r) {
    const otherVar = `Normally, I'd have to say "this.otherVar" :)`;
    return {
    update: function () {
    x += random(-.5, .5);
    },
    display: function () {
    ellipse(x, y, r);
    },
    otherVar
    }
    }
    const blobs = [];
    function setup() {
    createCanvas(600, 400);
    // "each" is a global unused variable, but who cares? :)
    for (each of Array(100)) {
    let x = random(width);
    let y = random(height);
    let r = random(10);
    blobs.push(Blob(x, y, r));
    }
    console.log(blobs[0].otherVar)
    }
    function draw() {
    background(0);
    for (const b of blobs) {
    b.update();
    b.display();
    }
    }

  • @kenan2386
    @kenan2386 3 роки тому

    I've learned to use p5.js thanks to you

  • @vincentcleaver1925
    @vincentcleaver1925 5 років тому +2

    I'm going to try heart shaped fireworks for my New Years Eve fireworks animation

  • @SuperTux20
    @SuperTux20 6 років тому +1

    Idea: Make your own version of the "SL" program in Bash.

  • @sikseike8701
    @sikseike8701 4 роки тому +1

    I cant use this code because «Firework» wich is only used once in this code is undefined? PLEASE ANSWER!

  • @realcygnus
    @realcygnus 7 років тому +3

    superb as per usual

  • @nitzan3984
    @nitzan3984 8 років тому +7

    Yesterday I've found out about your channel, insta-sub! Your videos are amazing, keep the good work going.
    3>.

  • @edwinstam2603
    @edwinstam2603 2 роки тому

    i've set the x velocity to Math.random() * 2 - 1 so they don't go in a straigt line

  • @richardj.rustleshyman2026
    @richardj.rustleshyman2026 8 років тому +1

    Damn, I love this series

  • @nosuchthing8
    @nosuchthing8 5 років тому

    Hey, you rock everyone's kasbah. How about the batman equation..

  • @mtbtechfilms1215
    @mtbtechfilms1215 6 років тому

    HSB alpha values are from 0 to 1 instead of the 0 to 255 that RGB uses.

  • @yayaskurt
    @yayaskurt 7 років тому +1

    Dude! You are awesome! I like all your vids!

  • @getmoon2ez703
    @getmoon2ez703 4 роки тому +3

    Did he really make "if(true) return true; else return false;" functions ...

  • @matrixgeg
    @matrixgeg 3 місяці тому +1

    nice

  • @vivsh.1999
    @vivsh.1999 Рік тому +1

    13:55, its not a bug its the Matrix 🤣

  • @bhuwansharmaa
    @bhuwansharmaa 2 роки тому

    it should be 0-1 range for the trail to work

  • @falicer
    @falicer 7 років тому

    Had to make this for school and this helped me a lot! Subbed and I will try to remake all you challenges (be patient I started like 1-2 weeks ago with this)

  • @nsk8ter524
    @nsk8ter524 7 років тому

    gonna do this, this week, thanks! happy 4th

  • @obiwac
    @obiwac 6 років тому

    great video, but id like to point out 3 things:
    1. why did you not just reset colour mode to hsb after background()?
    2. i think you screwed up your alpha for the particles, as they only fade away after the particle dies
    3. return ; not if () return true;
    else return false;

  • @pdsmart
    @pdsmart 4 роки тому

    WOW! Javascript has come a LONG way in 4 years. I vaguely remember setting up objects like this. Now it's so much closer to C# or Java. yay! 🎉

  • @circuitguru4554
    @circuitguru4554 3 роки тому +1

    Hi! So how would I code it to explode where my mouse is when I click it (no seed particles)?

  • @bs_blackscout
    @bs_blackscout 6 років тому +1

    this.pos.x * this.pos.y % 256 in HSB mode looks really nice

  • @mishuptm
    @mishuptm 7 років тому

    Yay, finally found the original this dot!

  • @dnetne5508
    @dnetne5508 7 років тому

    Please do python I watch you over a year and some videos twice love it . Because of you processing seems easier than easiest language to learn-python..

  • @cvryn7
    @cvryn7 7 років тому +2

    Checkout my implementation here: basic-fireworks.herokuapp.com/

    • @rainofsparks23
      @rainofsparks23 7 років тому

      When you mute and then un mute it, it freezes for a couple seconds. Just a heads up :D

  • @koinos_bacon
    @koinos_bacon 7 років тому

    Dude, your like-dislike ratio is insane. Just thought i'd mention. Keep it up, love what you do.

  • @nosuchthing8
    @nosuchthing8 5 років тому

    Nice shout out to batman

  • @Tea-Spin
    @Tea-Spin 6 років тому +2

    cool, gonna try to make this on my own for new year celebration.lol

  • @matija92
    @matija92 8 років тому

    your videos are amazing man! keep up the great work :)

  • @chaneloberlin2687
    @chaneloberlin2687 5 років тому

    why does it say "Framebuffer objects are not supported by this hardware or driver"?

  • @jasminedeath1767
    @jasminedeath1767 7 років тому +1

    that looked like shooting stars.

  • @halvorhansen
    @halvorhansen 7 років тому +8

    your rainbow background has the colours the wrong way around haha

  • @mauriciopereyra3339
    @mauriciopereyra3339 8 років тому +4

    that was so fun

  • @dominicrann6699
    @dominicrann6699 5 років тому +1

    So this is where the this . Song came from!!

  • @muhammadtalhaakbar7741
    @muhammadtalhaakbar7741 8 років тому +1

    Wasn't each particle supposed to fire off 100 new particles when its velocity becomes positive? From the point you created that part of the code to the end of the video, all I did was to wait for the moment when each particle fire off 100 new particles then each of those 100 new particles fire 100 each then it goes on and your browser crashes! Maybe, you checked if the particle was created from the original particle and do not need to fire off 100 more but, forgot to show?
    By the way, it's been 2 days and I am really appreciating this concept of programming through doing things graphically! Good work, man.

    • @adamthedog1
      @adamthedog1 7 років тому

      Lost Veteran I'm late, but the extra particles are called "fireworks" while the original particles are "firework"

  • @huongpham3580
    @huongpham3580 5 років тому

    helpful video!

  • @sikseike8701
    @sikseike8701 4 роки тому +1

    «Firework» is not defined?

  • @lorenzoraschi8877
    @lorenzoraschi8877 7 років тому

    GENIUS

  • @WarpedSpectrumMusic
    @WarpedSpectrumMusic 3 роки тому +1

    What if all the new explosions made more explosions as an infinite loop?

  • @endofmysteries
    @endofmysteries 8 років тому +1

    this is awesomeeee!! thanks Daniel son!

  • @knodelcrafter6888
    @knodelcrafter6888 8 років тому +5

    Supershape fireworks would ve interesting

  • @likeyou3317
    @likeyou3317 5 років тому

    Ohh so thats how u make a faded line in p5, just write background(0,40), and I tried to implement it with array of cricles following a moving point fading and decreasing the radius as time passess.. I wonder how they implemented with such great optimalization. 50 fading long lines and my pc would freeze :o

  • @KeatonHart.
    @KeatonHart. Рік тому

    12:28 bro said it first

  • @quadgen8049
    @quadgen8049 5 років тому

    Though i know that's its too late to comment,but after you have changed the color mode in the show function of particle class , the dull down effect of the particle has gone. The alpha value in HSB mode varies from 0-1.So you dont need to change the colorMode.

    • @TheCodingTrain
      @TheCodingTrain  5 років тому

      Never too late, thanks for the feedback!

  • @agorafobicoMusica
    @agorafobicoMusica 7 років тому

    Thanks for sharing! But why you don't use snippets!?

  • @mohammedjafaraqiq2119
    @mohammedjafaraqiq2119 6 років тому

    You are so talented..

  • @juliandominguez4308
    @juliandominguez4308 5 років тому

    I NEVER NEW THAT THIS LANGUAGE WAS THIS POPULAR!

  • @tzisorey
    @tzisorey 7 років тому

    Ahh, so that's where the This-Dot song came from.

  • @aryan_karim
    @aryan_karim 5 років тому

    BEST TUTOR EVERRRRRRRRRRRRRRRRRRRRR THISDOT LOL

  • @huyvole9724
    @huyvole9724 6 років тому

    It's good for health !!!! I will try convert it to C++

  • @MathRTD
    @MathRTD 7 років тому

    Using that boolean exploded insted of using null doesn't cause a lot of memory leak?

  • @tvk270
    @tvk270 7 років тому

    I love these vids

  • @MiloItz
    @MiloItz 7 років тому +1

    Is there a way to transform it into a screen saver? Awesome video man!

  • @amberjohnson6027
    @amberjohnson6027 2 роки тому

    I dont understand how he got to the stage before he starts coding where the library is imported and he can somehow see the code running on localhost, can someone help? I cant find anything online

  • @isen1
    @isen1 Рік тому

    24:35 why makes adding alpha to background a trail on the particle?

  • @manavbajaj218
    @manavbajaj218 6 років тому

    Bruh u are awesome I want to be like u in programing.

  • @RafaganAbreu
    @RafaganAbreu 3 роки тому

    How exactly works the trailing effect in fireworks? I don't get it.

  • @chlorisR
    @chlorisR 3 роки тому

    💎

  • @bhuwansharmaa
    @bhuwansharmaa 4 роки тому +1

    The trail was kind of a magic moment to me... (never done p5.js) can you please tell how the trail is being created?

    • @kuldeep130
      @kuldeep130 3 роки тому +1

      I think is because usually background is what clears the screen every frame by drawing a new background, if that background is transparent every frame a new background is drawn in top, which allows you to see the oldest frames, but every new frame makes the oldest backgrounds more opaque until after a certain amount of frames you do not see the firework past position anymore, which creates the illusion of a trail, I think that's how it works I hope I explained myself clearly

    • @bhuwansharmaa
      @bhuwansharmaa 3 роки тому

      @@kuldeep130 thanks, crystal clear :)

  • @alhdlakhfdqw
    @alhdlakhfdqw 7 років тому

    Great vids Thank u so much!! :)

  • @Patryk-Smith
    @Patryk-Smith 8 років тому +5

    Is there a 3D webcam interface like the PeasyCam library that is used in p5.js?

    • @avidcoder3901
      @avidcoder3901 6 років тому

      Patryk Smith i know i am late but you can look on the p5.js refrence. Im sure it does because processing and p5 are like twins

  • @thelavagod
    @thelavagod 4 роки тому

    i love how Atom editor has that
    hack code xD

  • @Krazy0
    @Krazy0 4 роки тому

    Hehehe...
    I'm like number 4k

  • @fodorbarnabas6983
    @fodorbarnabas6983 6 років тому

    In this video your voice reminds me the hungarian dub voice of Zach Galifianakis.

  • @jackiexu2840
    @jackiexu2840 6 років тому

    Can I ask a question? If I wanna show a letter, what am I supposed to make it? I've no idea which part should I change? Thanks

  • @Reyfild
    @Reyfild 7 років тому

    very nice job !

  • @rakshitranjan8040
    @rakshitranjan8040 2 роки тому

    rip atom editor
    wont miss u

  • @mastercode7851
    @mastercode7851 7 років тому +3

    i just watch this coz this guy typing fast asf !

  • @bennievaneeden2720
    @bennievaneeden2720 5 років тому

    can someone please explain to me why he is adding the force to the accelaration...? did he not just say the formula is F=m*a => F=a