9.4: JavaScript setTimeout() Function - p5.js Tutorial

  Рет қаралды 129,675

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 129
@CJ-pd7xg
@CJ-pd7xg 7 жыл бұрын
Dude. I want you to teach me every single topic that I have ever wanted to know.You're awesome.
@NASSIMELBOUJJOUFI
@NASSIMELBOUJJOUFI 6 жыл бұрын
The best teacher ever
@arnobchowdhury9641
@arnobchowdhury9641 6 жыл бұрын
Every time i watch one of your tutorials, i think to myself that it would be great if you had taught native Javascript (cause i am trying to learn it now). your videos are so well explained and yet so much fun to watch. Thank you sir.
@anmolarora5026
@anmolarora5026 6 жыл бұрын
finally im not the only programmer that gets sidetracked while talking
@Cambaudio
@Cambaudio 6 жыл бұрын
Thanks so much! None of the other videos or articles I read made sense or got my timing to work but yours did! I was finally able to after many hours make the loop I wanted. You have an awesome teaching ability. Again thank you so much.
@gary3548
@gary3548 4 жыл бұрын
Every time I watch one of your videos you make me smile and feel great. You are awesome! I need to watch more of your videos! So much more passion than the other coders out there!
@abdelrahman5094
@abdelrahman5094 5 жыл бұрын
you have an amazing way for explanation which makes you the best on youtube
@bejisan1
@bejisan1 5 жыл бұрын
Placing all my cloud function code inside the setTimeout 1st parameter did the trick for Node.js. Just needed to delay my datasnapshot by 3 seconds for it to catch up with my callbacks finishing writing to the database. Thx a lot, spent all day on it, and there were not many threads about it on stackoverflow. You saved what little is left of my sanity. /subbed to this channel.
@CivicYt
@CivicYt 6 жыл бұрын
I LOVE setTimeout. Can do so much for interactive things.
@koteswararao2182
@koteswararao2182 5 жыл бұрын
Good way of explanation.. very friendly and easy to understand in simple terms.
@somtovitus
@somtovitus 4 жыл бұрын
this guy breaths codes!
@goldthumb
@goldthumb Жыл бұрын
I like the recursion between setTimeout() and rainbow() in this example.
@greendaydave1210
@greendaydave1210 5 жыл бұрын
I had to delay audio for my app. This helped immensely!! Thanks!!!
@donutbedum9837
@donutbedum9837 3 жыл бұрын
wow. just wow. that was the most detailed explanation of anything i've ever heard of. wow thanks
@alexblue8524
@alexblue8524 5 жыл бұрын
this guy have good vibe, best teacher
@JOHN611
@JOHN611 4 жыл бұрын
OMG you are so good at explaining!
@guesminesrine7442
@guesminesrine7442 3 жыл бұрын
you have an amazing way for explanation , you are so funny , suddenly i love Javascript , i was looking for a video to understand and i've got you , Now im your student :D
@mahtabali4629
@mahtabali4629 3 жыл бұрын
this is the most fun and useful video i have ever watched
@samirghassane5654
@samirghassane5654 5 жыл бұрын
very simple and good explanation thanks dude
@keesdejong5712
@keesdejong5712 Жыл бұрын
this guy explain things like he is the long kid from the crazy frog video.
@Kim-xz7oz
@Kim-xz7oz 6 жыл бұрын
i like the way you teach its not boring
@christianwondeson8480
@christianwondeson8480 2 жыл бұрын
your energy is amazing
@makagyngrimm3392
@makagyngrimm3392 7 жыл бұрын
Is there any thing where the code will pause until something else is clicked by user?
@makagyngrimm3392
@makagyngrimm3392 4 жыл бұрын
@Marco Estors Lol
@carmencastro5512
@carmencastro5512 5 жыл бұрын
este tipo me encanta, hace muy agradable el aprendizaje de algo que me parece difícil...
@Elena-ht9ds
@Elena-ht9ds 3 жыл бұрын
you saved my exam
@terracoon9882
@terracoon9882 3 жыл бұрын
omg you have an exam in code! I want that to! better than netherlands...
@polditeref5162
@polditeref5162 4 жыл бұрын
I think Him and Dev Ed looks good for coloboration.
@_Psycho_logic
@_Psycho_logic Жыл бұрын
Bro I like your ENERGY ❤
@jboyle453519
@jboyle453519 2 жыл бұрын
finally a real explanation thank you thank you thank you
@computewitharjun
@computewitharjun 4 жыл бұрын
02:03 the prefix comes from the Latin mille, meaning "one thousand" (the Latin plural is milia).
@shpetimgashi7531
@shpetimgashi7531 3 жыл бұрын
In french it is Mille to say one thousand 👍👍
@tangflx
@tangflx 6 жыл бұрын
Daniel i watched all your vid not to lesrn but to see how funny you are. Lol. I love rainbows now
2 жыл бұрын
Thank you very much. You really helped me to understand this topic.
@tonifranke3868
@tonifranke3868 2 жыл бұрын
fav KZbinr now👍
@doniarabii5520
@doniarabii5520 5 жыл бұрын
I love the way you explain things and simplify them
@thealpha2503
@thealpha2503 3 жыл бұрын
One million rainbows done and another million on the way.
@aliaslani4529
@aliaslani4529 Жыл бұрын
The best best best best teacher❤❤❤❤❤❤❤
@parijatsaha3977
@parijatsaha3977 3 жыл бұрын
Awesome way of teaching :)
@FieelFlying
@FieelFlying 7 жыл бұрын
Awesomely explained thank you!
@bajtucha
@bajtucha 2 жыл бұрын
Nice video but I believe that it is a little bit oversimplified. You have no guarantee that callback function will run at the time you've set. You may be certain that it won't run before it but due to the mechanism behind it (task queue->event loop->stack) you should not rely on it.
@nikkonikko371
@nikkonikko371 4 жыл бұрын
Watching this when you're almost 1 million subs! So close!
@jadaneberly3852
@jadaneberly3852 4 жыл бұрын
super awesome tutorial, you are a great teacher !!
@terracoon9882
@terracoon9882 3 жыл бұрын
I really love your videos best teacher ever but can you set setTimeout to 0? to execute fast?
@leah.4783
@leah.4783 2 жыл бұрын
I want to code a jump and run and Iˋm new to coding. The ball goes up if the spacebar is pressed and I want it to come down after some time. SetTimeout doesnˋt work. What else can I do??
@thebrain678
@thebrain678 4 жыл бұрын
I was kinda stuck on how the code kept running every second but then it hit me. It's cause rainbow function keeps calling itself in a infinite loop. You made your own setinterval function. You could of got the same result with setinterval(rainbow, 1000) in setup.
@abcdef-bz7ew
@abcdef-bz7ew 2 жыл бұрын
Thanks for clearing my doubts. I was confused on that part as well
@Dat2Phit
@Dat2Phit 4 жыл бұрын
If you want to setTimeout to draw function do this: noLoop(); setTimeout(loop,1000);
@villurignanesh8458
@villurignanesh8458 3 жыл бұрын
I wanted to somehow pause the set timeout can I do it? I need help
@vennilav1890
@vennilav1890 5 жыл бұрын
Hi Daniel, I'm wondering why isn't setTimeout() working for draw function? Or are there other ways to stop draw() function for a couple of seconds?
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Take a look at noLoop() and loop().
@shaunbegley92
@shaunbegley92 8 жыл бұрын
Hey Daniel! That's a handy looking keyboard shortcut where you commented out a chunk of highlighted code. What is it? EDIT: Nevermind, I worked it out. Ctrl + / for anyone else wondering.
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Glad you found it!
@sadhlife
@sadhlife 7 жыл бұрын
The Coding Train, Do Atom or Brackets have a shrotcut for auto format?
@tanishq2766
@tanishq2766 4 жыл бұрын
@@sadhlife ctrl shift I
@sadhlife
@sadhlife 4 жыл бұрын
@@tanishq2766 it's been 3 years, I don't use those editors anymore, but thanks
@nelohenriq
@nelohenriq 2 жыл бұрын
How can i run a p5.js script for a certain number of seconds and then save the canvas and restart the script? run the script for 60 secs, save the canvas and restart script, so it's a loop or a while, while time is not 60 secs the script runs, then saves the canvas an restarts again for other 60 secs
@aloksingh4110
@aloksingh4110 4 жыл бұрын
I have a doubt, while using on a personal project, I noticed setTimeout(function, time) works but setTimeout(function(), time) does not. How can we pass a function in setTimeout with some value in it's parameters. i.e. how to make setTimeout(line(x1,x2,y1,y2),1000); work?
@ShaDoWChornos
@ShaDoWChornos 4 жыл бұрын
is there a version of that screen where he can have live test of his coding ? for windows
@EMonzon
@EMonzon 6 жыл бұрын
what about passing functions with arguments into a setimeout() or setInterval()? will it work out?
@ehsanag5837
@ehsanag5837 4 жыл бұрын
The third argument can be used to pass a variable to the function
@sgamer1770
@sgamer1770 3 жыл бұрын
Where did the createP function come from?
@donfeto7636
@donfeto7636 6 жыл бұрын
I wish all i wish is just You could teach us those thing but with out p5.js cuz i don't use it and i don't relate most of things which draw etc Btw You are Awesome Professional.
@emilbedreddinli1843
@emilbedreddinli1843 5 жыл бұрын
What if I write draw() function as a parameter of setTimeout() ?
@bryanDevsJS
@bryanDevsJS Жыл бұрын
great video! thanks
@i.i
@i.i 6 жыл бұрын
hi dan I think you have no video about bind() in javascript please make one
@sunnypatel4273
@sunnypatel4273 5 жыл бұрын
i need help!!!! how to auto close a popup windows set time:30 after close ?????
@jameschannel01182
@jameschannel01182 3 жыл бұрын
what if I wanted it in hours instead of milliseconds?
@moedeus111
@moedeus111 7 жыл бұрын
can someone tell me if its ok to use setimeout into the function ? cos its open a function into the function and again and again i think he is using to much recursion
@salihkurtov526
@salihkurtov526 5 жыл бұрын
Thanks!
@Karthik-pj6fg
@Karthik-pj6fg 7 жыл бұрын
can u tell me how to do array for a image,which is image collision on map for gaming purpose,i asked so many youtubers on this topic but they didnt gave correct response,hope u will answer
@kiranreddy7272
@kiranreddy7272 6 жыл бұрын
Thank u but iwant to timer stop in specific web site count down time for submit button
@EMonzon
@EMonzon 6 жыл бұрын
rainbows to all! haha!
@richochet
@richochet Жыл бұрын
Can someone explain why does it loop over and over?
@yytke
@yytke 6 жыл бұрын
I use the p5.js CDN in html And follow your code,but my chrome console told me that createP is not defined.... Should I import something instad of CDN? Thank you in advance
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Do you have p5.dom.js?
@yytke
@yytke 6 жыл бұрын
The Coding Train Thank you,sir. When I install p5.dom.js ,everything is OK. Thank you,you are my hero
@BrettClimb
@BrettClimb 8 жыл бұрын
This is really useful. Is there an equivalent function in Processing/Java? If so, do you have a video that uses it?
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Not really, but you can achieve the same results with threads and method reflection. It's infinitely more painful!
@BrettClimb
@BrettClimb 8 жыл бұрын
That's too bad, I guess Java isn't really designed for that. I've seen some people suggest using the Timer class, which is probably what you're referring too, so I think I'll try that.
@odetomy
@odetomy 6 жыл бұрын
I need help. I am completely new to coding and I'm getting frustrated. No offense to the teacher, because I must be missing something here. This did not work for me. All I want is a code that will execute different words at different intervals of time. I need this for a project I'm working on. For instance: at 10 seconds the word "Hi" pops up on the screen, then at 5 seconds the word "good" pops up, then at 3 seconds the word "baby" pops up, etc. I'm just using those words as random examples. I have looked all over the internet and none of the codes I find are giving me what I want!! I don't want to have to push a dang START BUTTON for the timed words to start running on a page. Nor do I want ALERTS! I just want different words to pop up. I don't want a pretty box or fields or any of that. JUST WORDS on a timed release bases. But apparently nobody wants to teach that! I've even tried repeating codes such as this example and it just doesn't work: function sayHi() { document.write("Hi") } setTimeout(sayHi, 1000); function sayHi2() { document.write("wad up") } setTimeout(sayHi2, 5000); function sayHi3() { document.write("watever") } setTimeout(sayHi3, 8000); However, I would like to add that the closest thing I have been able to create that works, so far, even though it has something like a START button is this: Things That Are Soft: Display Timed Words function timedWords() { var x = document.getElementById("txt"); setTimeout(function(){ x.value="Babies" }, 2000); setTimeout(function(){ x.value="Bunnies" }, 4000); setTimeout(function(){ x.value="Carpet" }, 6000); setTimeout(function(){ x.value="Pillows" }, 8000); }
@NoGoodHandlesComingToMind
@NoGoodHandlesComingToMind 5 жыл бұрын
Hi odetomy, Did you ever get an answer to your question? I'm kinda curious on the issue you've presented.
@maduagwuchinomso2340
@maduagwuchinomso2340 5 жыл бұрын
would have also love to know, how do i make a Html function to run for 10 seconds and leave the screen
@atyourservice5728
@atyourservice5728 4 жыл бұрын
Html function????😪😳😱😱😱😱😵😵😵
@claudioferreira4099
@claudioferreira4099 8 жыл бұрын
Hello Daniel, what type of programe did you use for editing the code? And its available for Windows? Thanks
@theentirepopulationofsyria
@theentirepopulationofsyria 8 жыл бұрын
Sorry if it's too late but here's the link to the downloads section on the p5js website: p5js.org/download/ You need to download the editor to write and run the code. Yes, it's available for Windows.
@renzoportaleone8432
@renzoportaleone8432 4 жыл бұрын
It works for me but if I exceed 10000ms it doesn't work. Because? I use licecycle maybe it has a time limit
@keshfreestyl8716
@keshfreestyl8716 3 жыл бұрын
You are like my second dad
@harshikerfuffle
@harshikerfuffle 5 жыл бұрын
I am unable to setTimeout to the draw function somehow
@willfahren-wasserski3459
@willfahren-wasserski3459 5 жыл бұрын
Great video, thx.
@sadhlife
@sadhlife 7 жыл бұрын
Correction: There's more to this. than that.
@geeknrd962
@geeknrd962 3 жыл бұрын
i wanna make a jumping game, but it jumps so fast, you cant see it.
@signaldog7805
@signaldog7805 3 жыл бұрын
How do I do a sleep inside a function
@signaldog7805
@signaldog7805 3 жыл бұрын
Oh
@alisaadati8006
@alisaadati8006 Жыл бұрын
tahnks for video
@eladrio2311
@eladrio2311 5 жыл бұрын
Oh man are you Italian?? My german brain can cope with da massive hand gestures! hahaha
@mshclips8981
@mshclips8981 2 жыл бұрын
thank you
@adwaiths5438
@adwaiths5438 8 жыл бұрын
Thanks for the rainbow :)
@deltaschool4302
@deltaschool4302 6 жыл бұрын
i fucking love you videos so much dude !
@butterbot333
@butterbot333 5 жыл бұрын
Hey im newbie and im trying to make a for loop that won't continue till after the setTimeout has finished but Everytime i try it crashes. Help!! I do something like For(var i=0: i
@tod3608
@tod3608 4 жыл бұрын
I think stuff() is undefined
@RamkrishanYT
@RamkrishanYT 2 жыл бұрын
Remember Stampy
@FullKnight51
@FullKnight51 6 жыл бұрын
Quickest 9:19 of my life.
@howaboutyu
@howaboutyu Жыл бұрын
thanks man
@tufu235
@tufu235 4 жыл бұрын
I want time killing bookmark... Or .... Gracemonley script. The web site SSMMS.. ..
@cap-advaith
@cap-advaith 5 жыл бұрын
I love u 3000
@ahmedzwawi6608
@ahmedzwawi6608 3 жыл бұрын
good rainbow !
@Eviatarm
@Eviatarm 7 жыл бұрын
so basically it's like Invoke()... in unity3d C#
@sadhlife
@sadhlife 7 жыл бұрын
It is!
@asmartbajan
@asmartbajan 6 жыл бұрын
4:08 It's still good practice to name the function, for debugging purposes.
@szaybhattacharya1022
@szaybhattacharya1022 9 ай бұрын
❤❤God ❤❤
@ritikkhatri
@ritikkhatri 7 жыл бұрын
4:33 still watching!
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
thank you!
@swily123
@swily123 4 жыл бұрын
Я один здесь русский?
@hodabi
@hodabi 6 жыл бұрын
I've had problems with this, so maybe I'm helping somebody, if you are trying to use this. inside setTimeout, you have to store a reference: var me = this; Then you can call setTimeout(function(){(me).something;},1000);
@pju999
@pju999 5 жыл бұрын
Thanks! Learning 'this' without using an arrow function and it helped me!
@justmeep8540
@justmeep8540 4 жыл бұрын
4:52 A bee is annoying you.
@nanzhaohz
@nanzhaohz 9 жыл бұрын
Nice Sweater!
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
well, thank you!
@ruchikabn5995
@ruchikabn5995 7 жыл бұрын
Hello Daniel!! You make great stuff !!! While I was trying one of the p5.js examples, that's the song one (p5js.org/examples/hello-p5-song.html) I tried to use it on my website. But the sound plays where ever I click. How could I sort it out? see what I tried www.nanduri.tk
@adminmabini448
@adminmabini448 3 жыл бұрын
CAN U PLS. STOP LAUGHING.. its annoying and u looks like ur not serious. 😐
@DrisrarFan01
@DrisrarFan01 Жыл бұрын
why are you laughing what's funny?
9.5: JavaScript setInterval() Function - p5.js Tutorial
11:41
The Coding Train
Рет қаралды 77 М.
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 1 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 2,9 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 66 МЛН
Who's spending her birthday with Harley Quinn on halloween?#Harley Quinn #joker
01:00
Harley Quinn with the Joker
Рет қаралды 27 МЛН
9.19: Prototypes in Javascript - p5.js Tutorial
19:24
The Coding Train
Рет қаралды 258 М.
JavaScript Event Loop -- Visualized!
29:43
ColorCode
Рет қаралды 19 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 567 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 276 М.
9.6: JavaScript Closure - p5.js Tutorial
12:15
The Coding Train
Рет қаралды 126 М.
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
How Do Linux Kernel Drivers Work? - Learning Resource
17:02
LiveOverflow
Рет қаралды 558 М.
Learn JavaScript CLOSURES in 10 minutes! 🔒
10:58
Bro Code
Рет қаралды 23 М.
9.15: 2D Arrays in JavaScript - p5.js Tutorial
12:38
The Coding Train
Рет қаралды 116 М.
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 2,9 МЛН