Such a interesting tutorial! It is so nice that you can explain things so vividly that I could understand it!
@juanpestana1582
6 жыл бұрын
Thank you so much Daniel, I'm so grateful you did this, know it's a little bit out of date but you're awesome.
@onthevergeofneon
7 жыл бұрын
you are everything I wish my prof was!
@000xsniper
8 жыл бұрын
Daniel Shiffman you are the greatest in this field ...... thank you so much for this tutorial how can i do a loop of vertex shaps with random value for x and y
@inventsable
7 жыл бұрын
Thanks Daniel! Wrote my own shape for a 6 point star that positions from center and I did both exercises with a single line in my draw block (I'm really happy considering I hadn't even started programming until two days ago, have you to thank for everything): float spacing = 80; float xPos = 40; float yPos = height/2; void setup() { size(960, 540); background(80); } void draw() { starLoop(); } void star(float x, float y) { fill(127); stroke(255); strokeWeight(2); //6-point star beginShape(); vertex(x, y-40); vertex(x+10, y-17.32); vertex(x+34.64, y-20); vertex(x+20, y); vertex(x+34.64, y+20); vertex(x+10, y+17.32); vertex(x, y+40); vertex(x-10, y+17.32); vertex(x-34.64, y+20); vertex(x-20, y); vertex(x-34.64, y-20); vertex(x-10, y-17.32); endShape(CLOSE); } void starLoop() { while (xPos < width) { star(xPos += spacing, yPos); } } void mousePressed() { if (mousePressed == true) { star(mouseX, mouseY); } }
@TheCodingTrain
7 жыл бұрын
Nice work!
@mattkaczmarczyk6953
6 жыл бұрын
this doesn't work 4 me....??
@User-in2mg
7 жыл бұрын
LOVE YOUR VIDS! Best teacher on youtube! void setup() { size(500, 500); } void draw() { background(255); loopiar(); } void xandy() { for (float f = 0; f < width; f = f += 70) { for (float s = 0; s < height; s = s += 80) { star(f, s); } } } void star(float x, float y) { fill(0, 255, 0); strokeWeight(2); stroke(255, 0, 0); beginShape(); vertex(x, y-40); vertex(x+10, y-17.32); vertex(x+34.64, y-20); vertex(x+20, y); vertex(x+34.64, y+20); vertex(x+10, y+17.32); vertex(x, y+40); vertex(x-10, y+17.32); vertex(x-34.64, y+20); vertex(x-20, y); vertex(x-34.64, y-20); vertex(x-10, y-17.32); endShape(CLOSE); }
@TheCodingTrain
7 жыл бұрын
Thank you!
@sabuchan122yt4
7 жыл бұрын
Java Coder couldn't you just popMatrix and pushMatrix with a translate. I know how it would be off a little because of translate but couldn't you just do translate(x-5, y-5);. The -5 on both sets it to middle.
@codewithryan4646
6 жыл бұрын
Really enjoying your videos! You're inspiring!
@yuzhao5883
3 жыл бұрын
the best coding training!!!
@tmtjitsu8352
8 жыл бұрын
Hey Daniel! Love the videos!! Only one thing I'm not understanding about this though! Where are these numbers coming from in order to make the relevant to x and y?
@beks2185
9 жыл бұрын
Good video, so easy to understand.
@KotatsuInUnova
4 жыл бұрын
Daniel you can do it
@xuyanyue7459
2 жыл бұрын
Epic tutorial
@RSkyCar
7 жыл бұрын
Hi, Daniel! What if I have no vertex x, y in my function, just ellipse() and fill() and noStroke(). How exactly can I provide arguments to make my colorful object reusable? Thank you!
@huntergoff2773
7 жыл бұрын
better late than never right?? void setup() { size(600,600); background(0); } void draw() { for(float x=25;x
@utkarshgupta9517
4 жыл бұрын
Where you defined "y" variable bro??
@zacarybaker1149
4 жыл бұрын
It's never too late! Lol
@johnsantos6027
4 жыл бұрын
For the mousePressed I just used an if statement in draw, if(mousePressed) { star(mouseX, mouseY); }
@ritulsinghal1283
3 жыл бұрын
@@utkarshgupta9517 In draw, star(x,300); 300 is the value of y
@jos9573
8 жыл бұрын
This might not be the most elegant piece of code, but here you go! void setup() { size(800, 800); } void draw() { background(51); for (int x = 0; x < width; x = x + 100) { for (int y = 0; y < height; y = y + 100) { star(x + 50, y + 50); } } } void star(float x, float y) { if (mouseX > x - 50 && mouseX < x +50 && mouseY > y - 50 && mouseY < y+50) { fill(255); } else { fill(51); } noStroke(); beginShape(); vertex(x, y-50); vertex(x+14, y-20); vertex(x+47, y-15); vertex(x+23, y+7); vertex(x+29, y+40); vertex(x, y+25); vertex(x-29, y+40); vertex(x-23, y+7); vertex(x-47, y-15); vertex(x-14, y-20); endShape(CLOSE); }
@niazomatic
8 жыл бұрын
}
@tanasedaniel54
4 жыл бұрын
Where did you get these numbers bro?(x+14,y-20),(x+47,y-15)???? This is the part I don't know what should I do if I don't have any vertex ... Sorryyyyyyyyy ... after watching this more careful I finally understand, thank youuuuuu
@keyb
3 жыл бұрын
Hello! Is there any way to assign a variable to a function? Or is there any way to redefine a function (that you defined with void?)? Many thanks, much appreated.
@ferdinandmarquita9259
5 жыл бұрын
Thank you sir for sharing your knowledge about this stuffs...
@Anton-wc7lb
4 жыл бұрын
Thanks for the tutorial !! I managed to create the loop with stars! However, for a similar project, I would need to make edits to the stars after they have been created, say, clicking on them makes them change colour. Any hints on how to accomplish this? :) Best // Anton
@ishahans6864
5 жыл бұрын
I'm trying to write a code for circles growing outward one after the other, but I want each circle to be a different color than the previous, have some time delay and originate from the same point. I have written the following code, but it works for only circle, no matter how many times I call the function with different arguments in draw. Can someone please help me figure what am I doing wrong, or suggest an alternative way to do this? float endX = width/2; float endY = height/2; void setup(){ size (600,600); background(0,100,255); } void draw(){ raza(255,80,0); raza(50,80,100); raza(255,255,102); } void raza(color a,color b,color c){ float x = 0; float y = 0; while (x
@CommonOnFire
8 жыл бұрын
Hello, can I use int instead of float for the arguments? But I have this problem with an array... void puntoInicial(int x, int y){... ... x[which] = mouseX; y[which] = mouseY; ...}
@TheCodingTrain
8 жыл бұрын
+Arturo G. in this case if x and y are arrays it would be: void functionName(int[] x, int[] y)
@afennelly99
5 жыл бұрын
How do you do the first exercise? Make a row of stars using a loop.
@johnbritt2426
6 жыл бұрын
Just for kicks! void setup() { size(600,600); background(0); } void draw() { for(float x=25;x
@babicpetar94
6 жыл бұрын
Daniel please help ! I bought your book and I cant get over the the exercise Convert F to C here is my code, where did I go wrong, because it keeps printing 0s. Help! void setup () { } void draw () { float Celsius = tempConvert(184); println(Celsius); } float tempConvert (float F) { float fToC= F-32; float multiply= (5/9); float Celsius = multiply*fToC; return Celsius; }
@GeodesicBruh
5 жыл бұрын
Petar Babic you used way too many variables lol
@YoshBruh
4 жыл бұрын
Halfway there boys
@josebringas513
5 жыл бұрын
Hi! im new in processing. I want to reuse functions for the bouncing ball sketch to generate other ones. Its just that idk where im failing at because the second ball displays on the screen but non of the balls moves. I added my sketch. Thanks for the answer ppl! float circleX; float circleY; float xspeed = 4; float yspeed = 4; float value = 0; void setup() { size(640,360); circleX = 0; circleY = 0; background(51); } void draw() { displayBall(0,0); moveBall(0,0); checkEdges(); displayBall(50,50); moveBall(50,50); } void displayBall(float circleX, float circleY) { fill(255); stroke(0); ellipse(circleX, circleY,32,32); } void moveBall(float circleX, float circleY) { circleX = circleX + xspeed; circleY = circleY + yspeed; } void checkEdges() { if(circleX > width || circleX < 0) { xspeed = xspeed * -1; } if(circleY > height || circleY < 0) { yspeed = yspeed * -1; } }
@keith3289
5 жыл бұрын
I'm new to this too but I think this may be your problem: When you call the function displayBall(0,0) you're instructing it to draw the ball at exactly position 0,0, I would think you need to call the function with the variables circleX and circleY instead i.e., displayBall(circleX,circleY). But you can only track 1 ball at the moment as you're only using one pair of variables, you'd have to things quite differently to use the same code to track more than 1 ball. The next video on re-usability sounds like it will be covering that.
@robby_zhang
5 жыл бұрын
@@keith3289 i wish there was a next one, because I'm trying to replicate something like the scenario above. would you have to create entirely new variables for it?
@Andrea-lf3jq
4 жыл бұрын
Is anybody else having problems with the code running? I typed the code out, but it gives me an uncaught syntax error for the void setup() { Not sure what I'm doing wrong
@nourel-denadel9757
4 жыл бұрын
what will happens if i wrote local and global variable of the same name???
@marcosdelfino9695
6 жыл бұрын
hi, my question is going to sound silly, but how do i get the exact coordinates for a star, i mean what kind of logic is everyone using to make them, i understand everything else, please help!!! thank you a lot :)
5 жыл бұрын
It really depends on what kind of star-shape you want to create. You can set some conditions to make it into a fixed shape and then use some highschool trig to find the coordinates. I personally would rather use unitary complex numbers to find the vertices and the inside points and then join them. If you want I can explain a bit more about that.
@TheBest-fj4qy
3 жыл бұрын
@ I know I am late but can u please explain?
3 жыл бұрын
@@TheBest-fj4qy Hi! Sadly, between that comment and now I realized that the complex number solution would not be much more flexible than the trig one, while being a lot more complex (pun intended). The reason being that p5 has some built-in functions like translate() and rotate() that do basically what I would have done with complex numbers so they're not really necessary in this context. I'd still use them if I were to create something where rotation and scaling plays an even bigger role (like a spiral o something) but I'd not recommend it for stars. Did you want me to explaing that or the trig solution? If you just want to know how to draw a star, I still could explain tho
@TheBest-fj4qy
3 жыл бұрын
@ Did he (Daniel) make any videos on how he made the star. I mean, I have been following his videos in order and suddenly I see a star being drawn and so not knowing what to do. And how do u use trigonometry to do that? And yes I am beginner trying to understand everything details as possible!! (:
@justsomebody8420
7 жыл бұрын
Why doesn't this code work? It leaves stars behind just by moving the mouse, not only when i click. void setup() { size(750,750); background(0); } void draw() { mousePressed(); beginShape(); vertex(mouseX,mouseY-30); vertex(mouseX+10,mouseY-3); vertex(mouseX+30,mouseY-3); vertex(mouseX+10,mouseY+3); vertex(mouseX+5,mouseY+15); vertex(mouseX,mouseY+7); vertex(mouseX-5,mouseY+15); vertex(mouseX-10,mouseY+3); vertex(mouseX-30,mouseY-3); vertex(mouseX-10,mouseY-3); endShape(); } P.S.: I think I'm not using mousePressed correctly, but this is the only way I don't get an error. I'm using Processing 3.2.3.
@justsomebody8420
7 жыл бұрын
Ok, thank you!
@mattkaczmarczyk6953
6 жыл бұрын
THANKS this really helped@@PattyGoesZoom
@carolinamattos2009
8 жыл бұрын
I can´t seem to find 7.5/6/7. Are they available?
@timeslongpast
8 жыл бұрын
Carolina Mattos I have found them really hard to find too.. I find going back to earlier videos and looks on the up next section often brings them up. Hope this helps :) also he might have a playlist of all these tutorial videos
@carolinamattos2009
8 жыл бұрын
+Brastin3 thanks, acording to his website there are no more 7. vídeos, it jumps right to unit 8. So I guess that is it. ;)
@kameron1563
9 жыл бұрын
ty sir.
@TheCodingTrain
9 жыл бұрын
+Kameron Gill thanks for watching!
@louiserouse7914
Жыл бұрын
We never got as far as return functions in this series 😭
@nilesinnott5638
5 жыл бұрын
What application is used to write your code
@TheCodingTrain
5 жыл бұрын
This video uses Processing (which is built on top of the Java programming language). For more info, visit processing.org and also this video might help kzitem.info/news/bejne/oqOip52BrJuqY6Q.
@nilesinnott5638
5 жыл бұрын
Thanks
@danielwatson6529
5 жыл бұрын
i got this far without getting stuck, then i got a bit stuck. i have pizza in the oven then ill watch it again and not be stuck i hope
@danielwatson6529
5 жыл бұрын
i got it! your a great teacher buddy!!
@labworx
5 жыл бұрын
where is the code of this example?
@FelixMT
5 жыл бұрын
I'm haven't done the second one but here is one way to do the first one void setup() { size(740,460); } void draw() { background(100); for (int i = 30; i < width; i = i + 75) { star(i,230); } } void star(float x,float y) { fill(255); stroke(0); strokeWeight(2); beginShape(); vertex(x,y-50); vertex(x+14,y-20); vertex(x+47,y-15); vertex(x+23,y+7); vertex(x+29,y+40); vertex(x,y+25); vertex(x-29,y+40); vertex(x-23,y+7); vertex(x-47,y-15); vertex(x-14,y-20); vertex(x,y-50); endShape(); }
@imosdefinite
4 жыл бұрын
1:28 sounded like a sound effect on a kid's show. (#wewantsoundeffects)
@luckymar7856
5 жыл бұрын
My Solution void setup() { size(600, 480); background(51); } void draw() { for (int x = 0; x
@Elxuekos
8 жыл бұрын
hey! what's vertex, endshape and startshape?
@TheCodingTrain
8 жыл бұрын
+Rodrigo Tallar Take a look here processing.org/reference/beginShape_.html
@Andrea-lf3jq
4 жыл бұрын
Is anybody else having problems with the code running? I typed the code out, but it gives me an uncaught syntax error for the void setup() { Not sure what I'm doing wrong
Пікірлер: 72