Bézier curves (Coding Challenge 163)

  Рет қаралды 262,153

The Coding Train

The Coding Train

Күн бұрын

Have you ever wanted to know more about bézier curves in p5.js? Thanks to a generous donation from Jason Oswald, I do a deep dive exploring the bézier curve function and the math behind the algorithm? Code: thecodingtrain.com/challenges...
p5.js Web Editor Sketches:
🕹️ Basic Example: editor.p5js.org/codingtrain/s...
🕹️ Editor by Simon Tiger: editor.p5js.org/codingtrain/s...
🕹️ bezierVertex Demo: editor.p5js.org/codingtrain/s...
🕹️ Time Table Cardioid with Bézier: editor.p5js.org/codingtrain/s...
🕹️ Quadratic Bézier Curve: editor.p5js.org/codingtrain/s...
🕹️ Cubic Bézier Curve: editor.p5js.org/codingtrain/s...
🕹️ Bézier Curve with Formula: editor.p5js.org/codingtrain/s...
🎥 Previous video: • Coding Challenge 162: ...
🎥 Next video: • Coding Challenge 164: ...
🎥 All videos: • Coding Challenges
Links discussed:
💰 #SupportP5 2020: discourse.processing.org/t/su...
💾 Jason Oswald (GitHub): github.com/gajoswald
💾 Processing Foundation: processingfoundation.org/
💾 bezier() - p5.js Reference: p5js.org/reference/#/p5/bezier
🗄 Bézier curve (Wikipedia): en.wikipedia.org/wiki/B%C3%A9...
💢 Custom Shapes: www.programmingdesignsystems....
💾 lerp() - p5.js Reference: p5js.org/reference/#/p5/lerp
Videos discussed:
🎥 Self Avoiding Walk - Coding Challenge 162: • Coding Challenge 162: ...
Related Coding Challenges:
🚂 81 Circle Morphing: • Coding Challenge #81.1...
🚂 133 Times Tables Cardioid Visualization: • Coding Challenge #133:...
Timestamps:
0:00 Welcome! Thanks Jason!
1:03 Explain! What is the bezier() function?
2:02 Explain! The difference between linear, quadratic, and cubic bezier curves?
2:34 Explain! What is a control point?
3:42 Code! Let's try the bezier() function!
5:02 Code! Now we can explore bezierVertex()!
7:13 But wait! How can we go farther?
7:39 Explain! How is lerp() related to bezier()?
9:09 Code! How can we draw a straight line with vertex()?
10:59 Explain! Lerpception!!
13:21 Code! Quadratic bezier!
14:47 Code! What if we connect the points from the two lerps?
16:02 Code! Cubic bezier.
19:21 Code! Let's bring back the rainbow!
20:17 Code! Moving points based on bouncing ball.
21:40 Wrap up. What will you create?
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: / discord
💖 Membership: kzbin.infojoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#beginners #beziercurves #lerp #javascript #p5js

Пікірлер: 318
@numberstationscartoon2689
@numberstationscartoon2689 2 жыл бұрын
This guy has such a talent for breaking down complex topics into digestible information. I am so grateful for this channel.
@KyleNally
@KyleNally 2 жыл бұрын
"I don't know what I've made here..." Why, you've made an old Windows screensaver, of course. I can't possibly be the only one who remembers this one!
@cipher3966
@cipher3966 2 жыл бұрын
Not the only one. I am from the 90s too.
@reyariass
@reyariass 2 жыл бұрын
He should remake the pipes ones
@Bunny99s
@Bunny99s 2 жыл бұрын
Well, you probably think of the old win95 mystify screensaver: kzbin.info/www/bejne/pl7LoKqDnauYmbM#t=8s It still existed in win XP: kzbin.info/www/bejne/q4u0o2Cdfd6MfKs This is the classic one. However there's a newer version called Mystify in win10: kzbin.info/www/bejne/r3aWc4eKqbV-eJY The old one just draws 2 quadrilateral where the 4 points are bouncy balls. Each of the two quadrilaterals have a certain amount of "history". So each frame the bouncy balls advance and a new shape is drawn, but the old ones still remain. so if a shape has a history of 12, there are always the last 12 copies of the shape on screen. When a bouncy ball was reflected it got a random velocity to add more dynamic to it. It was a very simply screensaver. The Win 10 version actually draws "curves". It's hard to tell because they added a lot of blur and glow and it fades out rather quickly. Though it may just be a leading vertex that moves around and drags the other control points behind by some constraints. While the general idea is similar, it works a bit different. They most likely just use a render buffer and never clear it as usual but simply let that buffer fade to black all the time. So the newly drawn shapes are bright while everything else is constantly fading away.
@icecrack4579
@icecrack4579 2 жыл бұрын
Hey, inspired by you, I downloaded processing, and is now learning about data types. Thanks for your wholesomeness, and positivity.
@windubitably
@windubitably 2 жыл бұрын
I really enjoyed seeing the code for that one screensaver from the 90s.
@gabeapger1846
@gabeapger1846 2 жыл бұрын
After years scratching my head about cubic splines, your explanation was the the most intuitive and clear. I will never forget this. Thank you for this great tutorial!
@thejintent2770
@thejintent2770 2 жыл бұрын
Absolutely one of your best videos yet! Keep up the great work!
@SteveRowe
@SteveRowe 2 жыл бұрын
Daniel, I love the work you're doing. Thanks for teaching!
@JBFFSK18
@JBFFSK18 2 жыл бұрын
wow, that was a great video. all those details, the video itself, the use of timestamps, the way it's cut/presented, just... everything
@oluwatomisinbabatunde8426
@oluwatomisinbabatunde8426 2 жыл бұрын
I've had a rough couple of weeks but this does put a smile on my face and I don't know how. Thank You.
@artistpw
@artistpw 2 жыл бұрын
I love watching these videos. These really are just amazing. With all of the lines, these absolutely resemble "shade sails".
@qwwongs33
@qwwongs33 2 жыл бұрын
Very nice content! I've implemented this algorithm before and used it frequently , especially bezier animation! I hope you can continue this series because i am very interested in understanding these type of algorithms. You are the man who brings me to the world of computer graphics, thanks man
@peterklenner2563
@peterklenner2563 2 жыл бұрын
The Bezier function was explained in such a casual and easy way. Just beautiful to watch!
@danielalvesaarte
@danielalvesaarte 2 жыл бұрын
I haven't watched the whole video, but I'm so happy that this exists and that you exists. Your work is incredible, and always makes me fell so happy. Also, I'm a visual artist and a programmer, your channel is perfect for me
@aurelia448
@aurelia448 2 жыл бұрын
currently learning some stuff for programming as i intend to study it in some years , the biggest thing about your channels is that you explain it in a really easy way , step by step and even the math behind it! the way you teach , explain and show is so funny and enjoyable! so much talent and so much passion for your channel i love it!
@eduardo_messias
@eduardo_messias 2 жыл бұрын
Another mind-blowing video. Congrats!
@jmckinney0040
@jmckinney0040 2 жыл бұрын
I have always wanted to know how this works! Also I've used a function similar to lurp before and I always wondered how it could do that. Thanks for breaking it down for all of us. Keep up the awesome work!!
@victoriaceliacesarferreira5766
@victoriaceliacesarferreira5766 7 ай бұрын
You're so passionate about teaching and coding, thank u so much all this free information
@Amr-Ibrahim-AI
@Amr-Ibrahim-AI 2 жыл бұрын
I love your passion! Thanks for the great tutorials and coding challenges :)
@rikfomiharbi6077
@rikfomiharbi6077 2 жыл бұрын
I love your videos, especially coding challenges so informative :)
@rossikatti1788
@rossikatti1788 2 жыл бұрын
You read the minds of artists/programmers: all your tutorials are gold!
@louiscoulon7408
@louiscoulon7408 2 жыл бұрын
the bouncing particles at the end really reminded me of the dvd thing hitting the corner of the screen
@anonymousvevo8697
@anonymousvevo8697 2 жыл бұрын
like usual , always stunning ! thank you , love it
@martingregson7136
@martingregson7136 Жыл бұрын
Once again, this guy has blown my mind with his simple, helpful, humerus interpretation and implementation of what would normally be a complex coding nightmare. Bravo, bravo... keep it up Dan...
@RobinFoxie
@RobinFoxie 9 ай бұрын
This is phenomenally useful and such a good breakdown. I've been clueless all morning; now 20 minutes later I'm sorted. Such a great video!
@Sabecontar
@Sabecontar 2 жыл бұрын
Nice. I've been following you for a hort time but already love your videos so much, that I started making my own videos inspired by you. Thanks
@Forjugadname
@Forjugadname 2 жыл бұрын
Really awesome vid. I've been using Bezier curves in Unity for a while even converted bezier code into DOT's code but I didn't understand the underlying bezier code, that is until now thanks to you.
@DogwafflDan
@DogwafflDan 2 жыл бұрын
Thanks for this video. I've been trying to come to grip with curves for decades
@thechargeblade
@thechargeblade 2 жыл бұрын
Thanks so much for the video, when you explain it, it is very intuitive and very easy to understand.
@afzalmahmudd8365
@afzalmahmudd8365 2 жыл бұрын
the explanation of the white bord.just wow! . thank you sir.
@tf2player943
@tf2player943 2 жыл бұрын
Used this to draw tubing for a project but didn't know the math behind it. Very interesting to see, thank you
@HritikRC
@HritikRC 2 жыл бұрын
The cool thing about this channel is that it literally covers almost every aspect of programming, even the JavaScript libraries. Keep it up!
@youreale
@youreale 2 жыл бұрын
Dan, you are a force of the nature. Thank you man!
@ninjaasmoke
@ninjaasmoke 2 жыл бұрын
I started watching the coding challenge series a weeks ago. For me it's been a week or 2, but for David it's been years! I'm inspired to see the love and enthusiasm he still has!
@cassiofbs
@cassiofbs 2 жыл бұрын
I love it too, but who is david?
@doctorbearphd
@doctorbearphd 2 жыл бұрын
Entertaining and educational as always! Love ya, man!
@itsjmmariano
@itsjmmariano 2 жыл бұрын
This is complex to me but the initial explanation made my understanding of this concept clearer. Thank you for this wonderful content!
@sps014
@sps014 2 жыл бұрын
Great explanation, finally these equations make sense
@wimjongman
@wimjongman 2 жыл бұрын
Awesome. I enjoyed that very much.
@velvetrock9933
@velvetrock9933 2 жыл бұрын
Right in the moment when i neede it! Thank you for a great content!
@wanderwithdaniel
@wanderwithdaniel 2 жыл бұрын
I love your work man !
@rosslahive
@rosslahive Жыл бұрын
Another great video, thanks so much.
@kken8766
@kken8766 2 жыл бұрын
love your videos! its practical, unique, challenging, and informative =)
@SridharGajendran
@SridharGajendran 2 жыл бұрын
A topic I always wanted to learn.. Thanks Dan..
@keremyaellandman5407
@keremyaellandman5407 2 жыл бұрын
Inspiring stuff, as always
@MichaelJamesActually
@MichaelJamesActually 2 жыл бұрын
I really enjoyed that! You made your very own Windows 95 Screen Saver!
@sumanthhegde5148
@sumanthhegde5148 2 жыл бұрын
It's so sad to see you getting old. Love you Daniel! You are amazing. :):
@rituchandra6325
@rituchandra6325 2 жыл бұрын
Amazing explanation for bezier curves! This explanation was so good that I probably will not forget how bezier curves are drawn, not after having heard the term "lerpception" XD. Once again, awesome explanation!
@avinash5651
@avinash5651 2 жыл бұрын
That's only one channel all over the KZbin which I like a lot I love to learn with u that's awesome moment
@richardlowenthal2366
@richardlowenthal2366 2 жыл бұрын
Thank you! This is a great tutorial.
@sshawarma
@sshawarma 2 жыл бұрын
This is so cool! I love it!
@tnczm
@tnczm 2 жыл бұрын
Just want to say the production is on another level now! I've been a fan for a while, and love your clear explanations!
@TheCodingTrain
@TheCodingTrain 2 жыл бұрын
Thank you, glad to hear that! (Especially given I had some audio issues with this one)
@juliankollatajmoves7860
@juliankollatajmoves7860 2 жыл бұрын
@@TheCodingTrain Yes, I love the way the production quality has evolved over the past 6 years that I've been watching! :D
@sauliustb
@sauliustb 2 жыл бұрын
liking the post editing. great vid :)
@andrewmackenzie2638
@andrewmackenzie2638 Жыл бұрын
Congratulations you made the old Windows Bezier screen saver! This is awesome.
@kristianwichmann9996
@kristianwichmann9996 2 жыл бұрын
Very lucid :-) For those interested, the mathematical process of finding a curve tangent to a family of lines (or curves) is known as an envelope.
@azayles
@azayles 2 жыл бұрын
14:46 This was the penny drop moment for me! The way the bezier was calculated, and the reason the curve doesn't come close to the control point, suddenly made clear 😮😀
@crewrangergaming9582
@crewrangergaming9582 Жыл бұрын
A developer for 10 years now, and watching this channel makes me love coding again.
@mjaisi5346
@mjaisi5346 Жыл бұрын
great work thank you!
@nightcoder5k
@nightcoder5k Жыл бұрын
I had a chance to write some dancing graphics with splines in X11 on a SunOS back in college. Great video on how splines work. Thanks!
@GroterRonald
@GroterRonald 2 жыл бұрын
Heel erg mooi, dank u voor de video J. Oswald
@JohnnyDub08
@JohnnyDub08 2 жыл бұрын
Thanks, very informative and entertaining.
@Nocfairy
@Nocfairy 2 жыл бұрын
Fantastic!
@JasimGamer
@JasimGamer 2 жыл бұрын
The master of inspiration I never understood what is lerp function Now its soo clear ❤
@HIHIQY1
@HIHIQY1 2 жыл бұрын
woah, bézier lines make sense now!
@gownerjones1450
@gownerjones1450 Жыл бұрын
This might just be the best programing channel on the entire internet
@marcodierenfeldt9061
@marcodierenfeldt9061 Жыл бұрын
This has been great fun!
@SrinivasMangipudi
@SrinivasMangipudi 2 жыл бұрын
Its amazing you never fail to entertain!! :D
@eointolster
@eointolster 2 жыл бұрын
When I get a job I'll donate again. Thank you for your work. Helped me get my last job
@brunesi
@brunesi Жыл бұрын
Oh man... you and your pineapple shirt... you brought a smile to my face already at 4:30... you got the gift of teaching... One would never snooze at your presentations.... very well done.
@HermanWillems
@HermanWillems 2 жыл бұрын
Amazingly explained. I don't have to say more. :) Bezier Curves are amazing.
@ashaygoli3014
@ashaygoli3014 2 жыл бұрын
Very well done video!!... Congrats you made a bezeir screensaver😆
@JesterUGA
@JesterUGA 2 ай бұрын
You made a screensaver, and it is awesome!
@ninjaasmoke
@ninjaasmoke 2 жыл бұрын
I was soo happy to see processing update their website to a react webapp!
@flwi
@flwi 2 жыл бұрын
That is an awesome explanation! Thanks for that! Got stuck on bezier curves a while back while trying to solve the Mars lander challenge on codingame. Maybe I'll give it another go, since I now know that bezier curves are not that mystical.
@mmilerngruppe
@mmilerngruppe 2 жыл бұрын
thank you!
@htoo-dev
@htoo-dev 2 жыл бұрын
Thank you sir, I've learned a lot from this vid.
@Gazaze
@Gazaze Жыл бұрын
i'll probably remember bezier curve as LERPCEPTION forever xD thank you so much for such a simple but great explanation!
@onebeartoe
@onebeartoe Жыл бұрын
I love this video! I wish I had seen in High school; the '90s.
@RahulRaj-pd7gi
@RahulRaj-pd7gi 2 жыл бұрын
Loved it
@AkshatRamanathan
@AkshatRamanathan 2 жыл бұрын
Ive been following this channel for the last 5 years and I went from someone who hated web dev to a working frontend developer. but the best part is I still subconsciously learn more about math than programming and i fucking love that.
@joweber7492
@joweber7492 2 жыл бұрын
Great video. Certainly demystifies the inner workings of Bezier curves. I also wanted to say that the coloured boxes that you draw around snippets of text really help to understand what you trying to point out. Keep up the great work!
@sinom
@sinom 2 жыл бұрын
Freya Holmér just made a great video about bezier curves a few days ago
@TheCodingTrain
@TheCodingTrain 2 жыл бұрын
I know!! It is so beautiful
@oghry
@oghry 2 жыл бұрын
Lerperfect video!
@rodakdev
@rodakdev 2 жыл бұрын
Very well made video
@hrishikeshjha4544
@hrishikeshjha4544 2 жыл бұрын
great video
@hamidbakhtiari3986
@hamidbakhtiari3986 2 жыл бұрын
Is this the first video with this new type of editing? IT IS AWESOME!!! I really liked it!
@giancarlodaravina
@giancarlodaravina 2 жыл бұрын
Awesome 👏
@THEN0RTH
@THEN0RTH 2 жыл бұрын
This is underrated!
@pw7225
@pw7225 2 жыл бұрын
A few years back I left a comment underneath a Coding Train video. It was critical because the content was too playful to me and too time-inefficient. I wanted to quickly learn what I had opened the video for. Now, I want to apologise for my arrogance. I think what you have done with Coding Train is nothing short of amazing. I hope many kids will be inspired by you to learn maths, computer science and create art. Never stop.
@sofia.eris.bauhaus
@sofia.eris.bauhaus 2 жыл бұрын
i've done a fair bit of drawing with bezier curves and i wrote a lerp fuction once, but i had no idea that a bezier is just a lerp of a lerp. that is so cool! :D
@reyariass
@reyariass 2 жыл бұрын
Same! That is just mind blowing to me!
@cmyk8964
@cmyk8964 2 жыл бұрын
The cubic Bézier curve we love is a lerp of a lerp of a lerp!
@sofia.eris.bauhaus
@sofia.eris.bauhaus 2 жыл бұрын
@@cmyk8964 or a lerp of two lerps, that's how i like to think of it.
@geetanjalitripathi3234
@geetanjalitripathi3234 2 жыл бұрын
Very useful!
@jackball9081
@jackball9081 2 жыл бұрын
Thank you very much
@amatiasq
@amatiasq 2 жыл бұрын
Thanks! just... wow
@SharonKlinkenberg
@SharonKlinkenberg 2 жыл бұрын
Wonderful
@ElNegro777
@ElNegro777 2 жыл бұрын
Woow great video
@Digiur
@Digiur 2 жыл бұрын
Congrats! You made a screensaver from windows 98! Beautiful!
@KyleNally
@KyleNally 2 жыл бұрын
Damn, and here I was scrolling through and feeling smug that nobody had mentioned it yet. Sigh.
@TheJas-vr2vr
@TheJas-vr2vr 2 жыл бұрын
Seeing cubic calling quadratic brings to mind the possibility of a quintic bezier, or even a recursive function that can go even further...
@M4tthy5Dev
@M4tthy5Dev 2 жыл бұрын
Nice video
@zipnone1996
@zipnone1996 2 жыл бұрын
This is a good one! 🥳🤩
@roygalaasen
@roygalaasen 2 жыл бұрын
Then you should look up Freya Holmér’s video on the subject released two days ago or something.
@TheGrenvil
@TheGrenvil 2 жыл бұрын
I remember when I was a kid and discovered that you can make a curve with straight lines and I started drawing a bunch of those curves messing with all sorts of parameters, apparently young had just rediscovered bezier curves, that's really cool
@Scotty-vs4lf
@Scotty-vs4lf 2 жыл бұрын
i actually used to do the same thing, when I saw the string art i was like wait what
@leonardoperina4036
@leonardoperina4036 2 жыл бұрын
Awesome tutorial as always, I hope it might help but to avoid the js rounding I wrote (in Processing) for(float t=0; t < 1+delta; t+=delta), I'm not sure it's the best solution but I think it might be more adaptable when delta changes. Anyway, the tutorial was extraordinary :D
@wchen2340
@wchen2340 2 жыл бұрын
I love the "and because they are seperate lines - I can make them rainbow colored" - part.
Coding Challenge: 3D on Apple II
45:40
The Coding Train
Рет қаралды 316 М.
Coding Challenge #93: Double Pendulum
31:11
The Coding Train
Рет қаралды 912 М.
Сын Расстроился Из-за Новой Стрижки Папы 😂
00:21
Глеб Рандалайнен
Рет қаралды 5 МЛН
ТОМАТНЫЙ ДОЖДЬ #shorts
00:28
Паша Осадчий
Рет қаралды 13 МЛН
The Beauty of Bézier Curves
24:26
Freya Holmér
Рет қаралды 1,9 МЛН
Coding Challenge 181: Weighted Voronoi Stippling
28:59
The Coding Train
Рет қаралды 145 М.
Curves we (mostly) don't learn in high school (and applications)
14:00
Coding the Collatz Conjecture
23:08
The Coding Train
Рет қаралды 127 М.
The Continuity of Splines
1:13:50
Freya Holmér
Рет қаралды 1,3 МЛН
Coding Challenge 168: MandelBulb 3D Fractal
28:02
The Coding Train
Рет қаралды 362 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 4,8 МЛН
Why flat earthers scare me
8:05
Sabine Hossenfelder
Рет қаралды 220 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,3 МЛН