I've been watching this YouTube channel where this professor at NYU teaches Java and JavaScript and he does these coding challenges. The guy is weird as fuck but for some reason his antics make it so I can actually learn the coding stuff w/o my eyes glazing over and wanting to kill myself.
Anyway, the most recent coding challenge was this little thing that you could put text in and it would convert that text into dots and those dots would automatically seek their location in order to form that text. Then you could move the mouse over it and it would scatter the dots within a certain number of pixels of the pointer and if the pointer was far enough from then the it would automatically move the dots back into place. At the end of the video the professor makes suggestions for what people should do with the code and one of the things was change the colors of the dots to colors of the rainbow. The channel used to be called Coding Rainbow (Like Reading Rainbow) and I figure that should be an easy enough thing to do. What I ended up creating though is a seizure inducer and I can't figure out what the fucking deal is. I'm pretty sure it's assigning a new color to each dot every time the draw() function runs but I'm at a loss at how to prevent that or change it.
Here's the code where I give it the color scheme
Code:
Vehicle.prototype.show = function() {
var vRed = [209, 0, 0];
var vOrange = [255, 102, 34];
var vYellow = [255, 218, 33];
var vGreen = [51, 221, 0];
var vBlue = [17, 51, 204];
var vIndigo = [34, 0, 102];
var vViolet = [51, 0, 68];
var RoyGBiv = [vRed, vOrange, vYellow, vGreen, vBlue, vIndigo, vViolet];
var vColor = random(RoyGBiv)
strokeWeight(8);
stroke(vColor[0], vColor[1], vColor[2]);
//stroke(255);
point(this.pos.x, this.pos.y);
}
Here's a github repo with the entirety of the code for the thing:
https://github.com/CodingTrain/Rainb...ing_Text_Paths