2.3: JavaScript Objects - p5.js Tutorial

  Рет қаралды 214,814

The Coding Train

The Coding Train

Күн бұрын

This video introduces the idea of objects in JavaScript using p5.js.
💻 Code: thecodingtrain...
💻 p5.js Web Editor Code: editor.p5js.or...
🎥 Next video: • 2.5: The map() Functio...
🎥 All videos: • Start learning here!
👾 Share Your Creation! thecodingtrain...
🚩 Suggest Topics: github.com/Cod...
🌐 Help translate this video: www.youtube.com...
🚂 Website: thecodingtrain....
💡 GitHub: github.com/Cod...
💬 Discord: / discord
💖 Membership: kzbin.info...
🛒 Store: standard.tv/co...
📚 Books: www.amazon.com...
🖋️ 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/Cod...

Пікірлер: 270
@pafou
@pafou 5 жыл бұрын
Just to let you know that there's now a new built in circle() function in p5.js so that this var declaration DOESN'T WORK anymore. Use any other name than circle when declaring your variable. Example : var c = {x:0,y:200,diameter:100}; ... ellipse(c.x,c.y,c.diameter,c.diameter); c.x+=1;
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Thanks, another reason I need to do this video!
@moonstone0999
@moonstone0999 5 жыл бұрын
wouldn't it be let
@pafou
@pafou 5 жыл бұрын
@@TheCodingTrain Hey you actually replied ! :) I didn't mean to be rude or anything, just wanted to make sure no one else would get confused. I love your videos btw you're a great teacher. Thank you very much
@sammystakethesnake9631
@sammystakethesnake9631 5 жыл бұрын
LMAO thank you! I have sat here for over half an hour wondering what I am doing wrong //everything 1 by one and then read this comment. also.... in the process i found out if you print() in draw you get stuck in a loop where it brings the printer options up....smh
@wighty28
@wighty28 5 жыл бұрын
@@pafouThank you for flagging this, because eI was going out of my mind trying to work out why my code wasn't working! Renamed the circle var declaration and it worked.
@saif_ali_khan
@saif_ali_khan 7 жыл бұрын
You start watching just ONE video and then you get hooked to it, like some awesome TV show ;)
@live_destin-3408
@live_destin-3408 6 жыл бұрын
lol I totaly relate lol
@warrengeorge7126
@warrengeorge7126 6 жыл бұрын
Quite agree. I have other things to do but it is like a box set and binge watching. Such a good teacher...
@logomoniclearning6680
@logomoniclearning6680 6 жыл бұрын
He is a great teaher becaause he varies between writing on the board to improve your conceptual understanding in addition to implementing the concept in code. This is very rare!
@nenenoch
@nenenoch 8 жыл бұрын
Daniel, you are the best programming teacher I have ever seen. Thank you
@parigyantamuly4295
@parigyantamuly4295 6 жыл бұрын
Your way of teaching way is unparalleled. Explained in such a lucid manner.
@JuztoKik
@JuztoKik 6 жыл бұрын
I just have to say your one of the first teachers for programming that I actually find super interesting to listen to. Keep up the great work!
@RameenFallschirmjager
@RameenFallschirmjager 5 жыл бұрын
Everything should be made as simple as possible, but not simpler. This man is doing it to the utmost!
@AK-py5kl
@AK-py5kl 7 жыл бұрын
@TheCodingTrain why do you always say "if anyone is actually watching this video" ? I love watching your videos. You're a very good teacher whose made coding so much fun and exciting for me ! I love your positivity. You're also one of the few KZbinrs for whom I have pressed the bell icon because I love watching all your videos ! So keep coding, keep making awesome content and always stay positive !
@ir2001
@ir2001 5 жыл бұрын
I paused the video there and was about to comment this!
@n0body-music934
@n0body-music934 4 жыл бұрын
i think he said that cus i think he did this for a class
@studyrelated8925
@studyrelated8925 5 жыл бұрын
My friend, Genuinely You are one of the best coding teachers I have ever had.
@mad1083
@mad1083 7 жыл бұрын
I have just about completed the js lesson in codecademy, watched countless tutorials from instructors and youtube personalities and I have never understood things this clear. You do a great job breaking things down without using "fantasticalness" that only gets in the way. Thank you so much
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
So glad to hear thank you!
@zayanwatchel8780
@zayanwatchel8780 7 жыл бұрын
Marlon Decosta learn native JS too!
@mad1083
@mad1083 7 жыл бұрын
I have noticed the importance of this. Thank you for your advice. Any advice is well received my friend so again gratitude.
@zayanwatchel8780
@zayanwatchel8780 7 жыл бұрын
Marlon Decosta yeah native is love native is life.
@urgisjot
@urgisjot 7 жыл бұрын
oh man, i'm rewatching this after a year, and i still love you!
@paxthewax4203
@paxthewax4203 4 жыл бұрын
It is insane how amazingly talented you are at explaining and your amazing and positive energy... we need more professors and overall people like you in this world... wow
@kamalbhatnagar5247
@kamalbhatnagar5247 5 жыл бұрын
Thank you Daniel!! For existing!!!!! You're awesome
@hellbenthorse
@hellbenthorse 7 жыл бұрын
Just started getting into JS and p5, it has been fun so far, thanks for your awesome series! Some random plotting fun: var windowW = window.innerWidth; var windowH = window.innerHeight; var moveX; var moveY; var firstLX; var firstLY; var secondLX; var secondLY; function setup() { createCanvas(window.innerWidth, window.innerHeight); background(60); frameRate(30); moveX = windowW * 0.10; moveY = windowH / 2; } function draw() { fill(rColour(), rColour(), rColour()); if (moveX 0 && moveY
@noahpayne8035
@noahpayne8035 7 жыл бұрын
I know these videos are from a while ago but very informative and the best ones I have found. Thanks Daniel!
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
So nice to hear, thank you!
@fabianvasquez3585
@fabianvasquez3585 5 жыл бұрын
This gentleman and Barnacules (Codegasm) are the best programing teachers I've ever come across on the internet. They make things feel elementary and fun.
@delahogue
@delahogue 6 жыл бұрын
This is how a teacher is supposed to be :)
@droneexpress6333
@droneexpress6333 5 жыл бұрын
Thank you so much Coding train i have been watching these videos for the past few days and i have learned so much. From knowing nothing to now writing my own program. Keep it up ! i know this video was made ages ago it is still perfect to use and learn so thank you so much for inspiring me to keep on coding.
@mishu13
@mishu13 3 жыл бұрын
Hey, I actually watch your videos for javascript, and I just love the simplicity of your teaching, it really gives a nice feeling like a real class, please keep doing such amazing videos. Helps beginners like me !!! :)
@jerriktorp8709
@jerriktorp8709 5 жыл бұрын
UPDATE!!! instead of circle you need to write circl
@frederikbuur
@frederikbuur 5 жыл бұрын
omg thank u so much!
@ansadutoit6765
@ansadutoit6765 5 жыл бұрын
Thanks!!!
@Shamysoza92
@Shamysoza92 5 жыл бұрын
I made it work using "let" instead of "var", however I'm still not quite sure what the difference is between var and let
@tienne_k
@tienne_k 5 жыл бұрын
Thank you so much!
@developerway9180
@developerway9180 5 жыл бұрын
Thanks a lot !
@heajincha
@heajincha 8 жыл бұрын
Thank you so sososos much for your detailed tutorials. Finally someone skilled enough to teach step by step (for dummies like me haha). I CAN ACTUALLY UNDERSTAND.
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
I'm so glad to hear, thank you!
@mad1083
@mad1083 7 жыл бұрын
same!!
@htruth1785
@htruth1785 7 жыл бұрын
Thank you. Was completely baffled reading about objects on a JavaScript textbook and this has cleared it up. In fact.
@Polly90Anca
@Polly90Anca 2 жыл бұрын
I needed this quick refresh - thanks for this quick video!
@johnvu3410
@johnvu3410 7 жыл бұрын
I am some what new to programming ,and have been bouncing around websites such as khan academy and code academy to learn the basics. But I have found that your videos are by far the most helpful and useful :) keep making more!
@ahmedr.
@ahmedr. 6 жыл бұрын
the concept of object . You nailed it in 5 min !
@epicclutchers233
@epicclutchers233 4 жыл бұрын
the best explained class ive experienced
@Hiatuz4
@Hiatuz4 6 жыл бұрын
got a udemy course and you explained it a lot better
@eti313
@eti313 5 жыл бұрын
What's the course?
@nathen1778
@nathen1778 4 жыл бұрын
THIS DUDE ACTUALLY HELPS!!!
@bondies777
@bondies777 5 жыл бұрын
In under 10mins I finally understand why JSON is how it is
@goldthumb
@goldthumb Жыл бұрын
Other than JavaScript and p5js, I learned tons of "enthusiasm" from Daniel.
@dukewright327
@dukewright327 5 жыл бұрын
@TheCodingTrain I’m very new to coding and you make it easy to learn.
@ivanpetrovic-poljak6411
@ivanpetrovic-poljak6411 7 жыл бұрын
I know this is a late comment but from watching your coding challenges I actually managed to reset the circleX variable to 0 when it hits the edge of the screen and also do the same thing with the mousePressed function!
@wubbawubster3611
@wubbawubster3611 5 жыл бұрын
you are awesome, never stop !
@256beans
@256beans 9 жыл бұрын
I'm enjoying your videos. You're a really good teacher!
@TheCodingTrain
@TheCodingTrain 9 жыл бұрын
+256beans Thanks so much!
@mayurahuja817
@mayurahuja817 4 жыл бұрын
you are the best Teacher Dan !!!!!
@vitoremanuel3429
@vitoremanuel3429 5 жыл бұрын
If you're following along with the editor, use "let" instead of "var" to declare the circle object .
@terkuz103
@terkuz103 5 жыл бұрын
Thank You.
@vitoremanuel3429
@vitoremanuel3429 5 жыл бұрын
;)
@slinderdub9586
@slinderdub9586 5 жыл бұрын
so if i use "let" is it ezer then "var"
@vitoremanuel3429
@vitoremanuel3429 5 жыл бұрын
@@slinderdub9586 nope. I'm not sure why, but I believe it's just because in the video the editor is probably using a "version" of JS that didn't have "let" established as a new way to declare an object or a variable (pre es6 maybe). While following the tutorial, I tried using "var" on the p5.js web editor just like Dan did, and the code wouldn't run, but when I changed it to "let", it did.
@redrunn3388
@redrunn3388 5 жыл бұрын
The best thing about this is that you can use ONE let (var) function to create variables that you can use for several shapes at once. It's very neat and saves u tons of space if you use it that way.
@migueltejeda3869
@migueltejeda3869 6 жыл бұрын
it's like I am doing some javascript and then forget how, in this case, Objects worked, so i get on youtube and search your name so that you can remind me. it's been the same for a lot more. THAK YOU!
@abohnsack21
@abohnsack21 7 жыл бұрын
Great videos! You are actually easy to listen to and you make the videos enjoyable. I'm on ground zero with this stuff and you make it interesting.
@zuggrr
@zuggrr 8 жыл бұрын
thank you so much. great videos you are awesome and funny :)
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
Thanks for watching!
@andonandonov7793
@andonandonov7793 6 жыл бұрын
This guy is unique, love it xD
@mauisurfer3
@mauisurfer3 8 жыл бұрын
Thanks for all your work! I am just learning this stuff for fun and these vids are awesome!
@kijekori2385
@kijekori2385 4 жыл бұрын
Hey Dan, you made learning coding is very interesting. Keep this up bro, thanks a lot!
@osamagamal495
@osamagamal495 5 жыл бұрын
first video to watch. And I like the way you teach.
@johnbreechvillaverde7189
@johnbreechvillaverde7189 5 жыл бұрын
I really learn al lot from you thanks man
@tarekmustafa2525
@tarekmustafa2525 8 жыл бұрын
Amazing videos about JS and p5. Great work!
@Hurriicane89
@Hurriicane89 4 жыл бұрын
i started watching these videos because i want to create some confetti and i'm really hoping these will help me understand how!!
@berylsam889
@berylsam889 7 жыл бұрын
why didn't i discover p5.js earlier ?? found you through your p5.js video gamin tutorials !! looks pretty fun and logical so i found my interest in p5.js !! love your videos !! great teacher for a beginner ( although i am familiar with the coding world)
@caparag1114
@caparag1114 4 жыл бұрын
your videos are very interestng. i dont get bored. instead i feel to see whats next whats next
@harrisgagnon2228
@harrisgagnon2228 7 жыл бұрын
Amazing tutorials you make coding fun!!
@aniprice86
@aniprice86 5 жыл бұрын
Just saying that they have made a update and you can’t use the word circle because it’s in the reference I needed to change it to circl
@marwa-zr8vk
@marwa-zr8vk 5 жыл бұрын
thank you
@aniprice86
@aniprice86 5 жыл бұрын
Pleasure ❤️❤️❤️
@MoizQazi
@MoizQazi 7 жыл бұрын
You are awesome..I love how you get excited about silly things in your code.. Goes on to show how much you like teaching code.. Kudos !!!
@zayanwatchel8780
@zayanwatchel8780 7 жыл бұрын
Abdul Moiz I legged someth by OMFG
@Steve01ification
@Steve01ification 6 жыл бұрын
var circleX = 20; var circleY = 20; var circleW = 20; var circleH = 20; function setup() { createCanvas(640, 360); background(200,100,150); } function draw() { ellipse(circleX,circleY,circleW,circleH) circleX = circleX + 2; circleY = circleY + 1; circleW = circleW + 1; circleH = circleH + 1; }
@steveholcomb4080
@steveholcomb4080 7 жыл бұрын
Such an awesome video. He's the best online in my opinion. .
@youvnasalian2224
@youvnasalian2224 3 жыл бұрын
how can I ever thank you enough:)
@lindavasquez5736
@lindavasquez5736 7 жыл бұрын
THANK YOU!! I totally understand objects now :)
@daanbrocatus9340
@daanbrocatus9340 8 жыл бұрын
I love your videos, I've learned a lot!
@milehiaviation
@milehiaviation 7 жыл бұрын
I wish you taught just plain Java. I'm in AP Computer Science right now with a below average teacher and I'm so beyond lost. No one else on KZbin teaches code as well as you.
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
This playlist is actually Java using the Processing IDE (and any challenges using Processing are also Java): kzbin.infoplaylists?view=50&shelf_id=2&sort=dd
@terribleshorts5598
@terribleshorts5598 6 жыл бұрын
so far out of all of this i have made this var circleX = 0; function setup() { createCanvas(600, 400); background(207, 0, 0); } function draw() { fill(circleX, 0, circleX); noStroke() ellipse(mouseX, mouseY, 50, 50); circleX = circleX + 0.1; } function mousePressed() { background(207, 0, 0); var circleX = 0; fill(circleX, circleX, circleX); noStroke() ellipse(mouseX, mouseY, 50, 50); circleX = circleX + 0.1; } and i have managed to make some cool artwork
@toastyPredicament
@toastyPredicament 2 жыл бұрын
dan you're cool keep it up thank you have a blessed day
@pkmarsden
@pkmarsden 5 жыл бұрын
They have updated p5.js since then and it now has a circle function so if you call circle it doesn't work. You need myCircle or similar.
@luisfernandoyupanquitaco8630
@luisfernandoyupanquitaco8630 5 жыл бұрын
You save my life
@aaronhyrne9811
@aaronhyrne9811 5 жыл бұрын
this video should be updated the current version of p5 editor in the browser dosent let you use circle as a variable because its a 2d shape input now
@taihatranduc8613
@taihatranduc8613 4 жыл бұрын
thank you, you are an awesome person
@Tsskyx
@Tsskyx 9 жыл бұрын
I'm used to processing OOP, where you first put data into constructor, which then passes that data to the actual object. Is this the same thing? It looks too simple to be an object, without all that class and constructor stuff.
@TheCodingTrain
@TheCodingTrain 9 жыл бұрын
+Tsskyx This is somewhat different b/c there is no "class" here. Just a literal object. However, something more similar to what happens in Processing is creating a JS object with a constructor function. This comes in 6.4 kzbin.info/www/bejne/fGSqloCVgNd6oKs
@BrettClimb
@BrettClimb 8 жыл бұрын
+Tsskyx Using a javaScript constructor might look like this: function MakeCircle(xPos,yPos,diameter) { this.x = xPos; this.y = yPos; this.d = diameter; } var circle = new MakeCircle(300,200,20); This would create a circle object that looks like this: { x: 300, y: 200, d: 20 }, and that constructor could be used to make other similar objects as well.
@Stuff_And_Things_0
@Stuff_And_Things_0 8 жыл бұрын
Hi, great videos. Working my way through hoping to create a simple game of my own at the end! I was wondering about doing things in the object variables such as: var ball = { pos: createVector(25,25), height: random(0, 100) } It says that these things are undefined. I'm sure the problem is glaringly obvious but I thought it would be useful to define these variables like this in the object. Cheers!
@xelacrypt
@xelacrypt 5 жыл бұрын
avoid using "circle" as an object name - it conflicts with p5 and makes values inside it undefined, use smth like ball, krug or any other unused name!
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Ah, great point!! circle() didn't exist when I made this video, but it's definitely a problem now that it does!
@luantingxian7812
@luantingxian7812 5 жыл бұрын
Thank you for pointing it out! I got stuck when using "circle" as object name: exactly the same code as in the video, but nothing happened in my editor. Now fixed it using a different name.
@aryaz
@aryaz 5 жыл бұрын
thanks !
@PeterRigert
@PeterRigert 5 жыл бұрын
Thaaaank you!
@simontewolde3616
@simontewolde3616 9 жыл бұрын
Is the video about adding functionality to objects coming any time soon? I'm really interested in knowing how to do that.
@YataVSTheWorld
@YataVSTheWorld 7 жыл бұрын
weird: If I turn r,g,b into a color object it will simply make the background to the same color of the circle (also if the circle is filled with another set of number). If I made a cast like r=color.r and then i use r in the background function everything is fine...but if I try to call the function as Background(color.r,color.g,color.b) the same original problem (background and circle of the same color). Notice that the background is actual made of the same color of circle and not simply not called...because the circle doesn't leave a trace behind when it moves.
@stoenchu122
@stoenchu122 6 жыл бұрын
Interesting, funny and simple explained.
@srthinktank7739
@srthinktank7739 6 жыл бұрын
Thank you! you are just AWESOME!!!!!!!!!!!!!
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Thank you!
@PixelDolphin
@PixelDolphin 5 жыл бұрын
I don't understand why can my variable test.x work, but my circle.x is coming out undefined. Please help :< var circle = { x: 200, y: 200, size: 22 } var test = { x: 200, y: 200, size: 22 } function setup() { createCanvas(400, 400); background(220); } function draw() { background(220); //circle.x += 5 //circle.y += 5 //circle.size += 1 fill(22) ellipse(circle.x,200,22,1) print("circle var: " + circle.x) print("test var: "+ test.x) }
@PixelDolphin
@PixelDolphin 5 жыл бұрын
Watched further on. Later video helps understand the issue. Basically have to change the name of the variable because some names have conflicts with the p5 library. I’m guessing this issue could come up in other languages, good lesson to learn!
@OctoBirb8Claws
@OctoBirb8Claws 6 жыл бұрын
I made an in app purchase (Add Mode) for p5.js and it opened my program's IP Address When I ran my program. (1st time it just read p5.js as a JS file)
@7hourslater
@7hourslater 8 жыл бұрын
loving your videos ! also when do you go live? is there a certain time you like to go live ?
@JurajPecháč
@JurajPecháč 8 жыл бұрын
Sign up for live stream notifications via e-mail on shiffman.net
@kristinatumbles1764
@kristinatumbles1764 4 жыл бұрын
Hey, so I did a code to move with up down left right and it said there was something wrong when i had space between: If(keyIsDown(DOWN_ARROW)) (here was the error) { y = y + 2 } Do you know how to make the error go away?
@braeden9971
@braeden9971 8 жыл бұрын
you helped me so much love you
@lomzart
@lomzart 8 жыл бұрын
Thank you! You are really good!
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
+Vukasin Stancevic (Lomz) thanks for watching!
@isaacvargas412
@isaacvargas412 8 жыл бұрын
Great Vids!! I have a quick question. I want to set up an object to use in both setup function and in the draw function but It seems to only work if I make two separate objects written inside the functions. (these objects are identical) Is there a way to only have to write the object once and use it anytime in the code?
@bigsmokeutube
@bigsmokeutube 3 жыл бұрын
Let’s give him 2 million subscribers. I don’t know how 🤷‍♂️.
@vanmustang1119
@vanmustang1119 8 жыл бұрын
You are funny teacher, i like this king of teacher. THANKS FOR THIS
@Soulixs
@Soulixs 7 жыл бұрын
what is the difference of having the x = x +1 on top of ellipse function rather than the bottom of the function??
@vxcvbzn
@vxcvbzn 8 жыл бұрын
Making circles with Jason! :)
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
hah!
@eniocc
@eniocc 5 жыл бұрын
Thank you sir.
@nicolasmarinoparra9107
@nicolasmarinoparra9107 5 жыл бұрын
OBSERVATION: The name of the variable "circle" is already a name of a library function. Thus, the program will get stuck. TRY TO CHANGE THE NAME of the variable, in order to get the dot notation functionality. (Maybe this program worked in this video beacause this library is a old p5.js version, which could mean that the "circle" function had not been created at that time)
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Indeed! I would recommend using something else like "bubble"!
@coelan5683
@coelan5683 8 жыл бұрын
Hello, what a great video !!! I'm french and it's a pleasure to learn coding situ you. I've just a little question, I installed P5 on my mac but I don't have your "play/stop" button to test m'y code, where can i find it please ?
@zerosandones7547
@zerosandones7547 7 жыл бұрын
So entertaining man 😇
@nimbus1583
@nimbus1583 7 жыл бұрын
HELP! several times I've reloaded, saved and opened the canvas using a browser but it never works: I am usin brackets
@antoniagrosan9504
@antoniagrosan9504 7 жыл бұрын
it happens the same to me! :(
@TheMaddestDan
@TheMaddestDan 7 жыл бұрын
It does work in brackets, but your code needs to EXACTLY the same on every line. It's been a month since you commented so maybe you sorted it out, but my "circle.x" was "circle. X" and it didn't work for me because it was capitalized. If you can link to your code, if you still have the problem, I'm sure we could figure it out. It definitely is working in Brackets though cause that's what I used.
@okalaadamabdulmuhsin2276
@okalaadamabdulmuhsin2276 7 жыл бұрын
I'm facing the same problem. My canvas and work progress doesn't show on my chrome default browser. I use Brackets.
@TheStormWorm
@TheStormWorm 5 жыл бұрын
Thanks so much for the videos. I had issues with this tutorial. All my syntax lined up just like the video with no errors and I still couldn’t get the circle to display. I changed var circle = to let circle = and the circle popped up on my screen. I am curious as to why this is?
@chankballyesh3952
@chankballyesh3952 5 жыл бұрын
is there spaces also I had the same issue
@TheStormWorm
@TheStormWorm 5 жыл бұрын
I just used his exact example and just changed the word var to let.
@chankballyesh3952
@chankballyesh3952 5 жыл бұрын
oh ok thx
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
You can also ask at discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.
@santiagorios2969
@santiagorios2969 3 жыл бұрын
what is the difference between var and let ? Hello Daniel from Colombia, you are amazing !
@zerosandones7547
@zerosandones7547 7 жыл бұрын
Whats the compiler your using?
@CerebroVasconcelos
@CerebroVasconcelos 7 жыл бұрын
thank you by subtitles
@meghnasharma7908
@meghnasharma7908 4 жыл бұрын
just check the code and let me know what mistake i have done because i think i have done everything the same as you have done but yet it says error: var circle1 = { x: 0, y: 200, daimeter: 50 }; var circle2 = { x: 0, y : 200, daimeter:50 } var r = 218; var g = 160; var b = 221; function setup() { createCanvas(600, 400); } function draw() { //background background(r, g, b); //ellipse fill(250, 200, 200); ellipse(circle.x, circle.y, circle.daimeter,circle.daimeter); circle.x = circle.x + 1; }
@alexanderkalchev188
@alexanderkalchev188 5 жыл бұрын
i make my object and there isn any error but it happens anything when i start th e program
@nimbus1583
@nimbus1583 7 жыл бұрын
Does this not work In brackets?
@zayanwatchel8780
@zayanwatchel8780 7 жыл бұрын
Try atom.
@kingwindie
@kingwindie 7 жыл бұрын
works in atom
@Es.me44
@Es.me44 6 жыл бұрын
Yes. Impor the p5.js cdn into your HTML file, whrite your code and run(ctrl+ alt+p)
@ahmadhy9542
@ahmadhy9542 5 жыл бұрын
I did the syntax dot and everything is right no console errors but the ellipse does not show it's just the black background can any one help me please
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Would you mind asking at discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.
@antoniagrosan9504
@antoniagrosan9504 7 жыл бұрын
This doesn't work in brakets, please help! Should I use processing?
@TheCodingTrain
@TheCodingTrain 7 жыл бұрын
What error are you getting? Try posting at forum.processing.org? It's easier for me and others to help that way (you can share code there easily!). Feel free to tweet me @shiffman a link so I can follow / contribute!
@imrozeahmed9082
@imrozeahmed9082 4 жыл бұрын
hello sir, which programming editor are you using ???
@parthawari843
@parthawari843 4 жыл бұрын
he is using p5 web editor editor.p5js.org/
@vipuldimri6571
@vipuldimri6571 7 жыл бұрын
Where are these object stores. Like we have heap for storing java object. I am a Java guy trying to learn Javascript.
@maremeaxi3344
@maremeaxi3344 7 жыл бұрын
amaizing !!!!!!
@randmorf
@randmorf 4 жыл бұрын
When I run the demo program in this video, with the 2019 version of P5-JS Editor, I keep getting the following error message repeated over and over again, and I hape to press the stop (square) button to regain control. Error message: p5.js says: ellipse() was expecting at least 3 arguments, but received only 1 at about:srcdoc:80:3. [p5js.org/reference/#p5/ellipse] I think this means that the OOP capabilities ib P5-JS have changed since 2015 or whenever this video was made. Anyone else have this problem. Searching for an answer, I did find an example of a OOP in the P5-JS reference at this URL [ p5js.org/examples/objects-objects.html ] which suggests using a more Java like OOP syntax.
@randmorf
@randmorf 4 жыл бұрын
Okay, seems another person had this problem, said not to use the reserve 'circle' in your program for your object names. Use anything like "c1" or "c2" or maybe "bug".
@barickfoster
@barickfoster 9 жыл бұрын
HI Dan in the object var circle1{ x:0, y:200, diameter:50
@TheCodingTrain
@TheCodingTrain 9 жыл бұрын
An object is a list of name value pairs separated by commas. It just so happens that when you get to the end you don't need a comma after the last element. If I write it like this it might be more apparent: { x:0,y:0,z:0 }
@barickfoster
@barickfoster 9 жыл бұрын
i got it !!!! thanks
16.7: Array Functions: reduce() - Topics of JavaScript/ES6
14:40
The Coding Train
Рет қаралды 133 М.
6.2: Classes in JavaScript with ES6 - p5.js Tutorial
20:09
The Coding Train
Рет қаралды 406 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,2 МЛН
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 3,9 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 40 МЛН
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 1 МЛН
5.1: Function Basics - p5.js Tutorial
12:35
The Coding Train
Рет қаралды 148 М.
An Encounter with JavaScript Objects
10:38
Fireship
Рет қаралды 147 М.
3.1: Introduction to Conditional Statements - p5.js Tutorial
11:31
The Coding Train
Рет қаралды 204 М.
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 973 М.
STOP Using Classes In JavaScript | Prime Reacts
14:02
ThePrimeTime
Рет қаралды 251 М.
7.4: The Constructor Function in JavaScript - p5.js Tutorial
12:39
The Coding Train
Рет қаралды 104 М.
why are switch statements so HECKIN fast?
11:03
Low Level
Рет қаралды 429 М.
7.3: Arrays of Objects - p5.js Tutorial
14:22
The Coding Train
Рет қаралды 170 М.
Programming Is Cooked
9:30
ThePrimeTime
Рет қаралды 312 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,2 МЛН