I know how to do it with black and white example I would like it to be purple instead of black but I can’t do it. I would like to achieve something like this. Answer I dont know much about p5.js. But simple googling and would offer this solution With lerp color you could create implementation that supports even more
Tag: trigonometry
Using Trigonometry to draw equidistant parralleles lines through a circle
As seen on the picture, I need a math formula that calculate the red circled point with cartesian coordonate that will make equidistant lines. It is not simple trigonometry I guess… My goal is to be able to calculate cartesian point around half of the circle and trace my lines from it. Using p5js, I’ll use random value from Perlin
D3js find closest point on circle
what I’m trying to achieve is to take the current coordinates of a mousemove event and match them with the coordinates of the closest location on a circle. I’ve managed to get this partially working using a for loop which iterates over each possible point in the circle and compares the coordinates in order to find the closest point: the
calculating intersection point of quadratic bezier curve
This is definitely pushing the limits for my trig knowledge. Is there a formula for calculating an intersection point between a quadratic bezier curve and a line? Example: in the image below, I have P1, P2, C (which is the control point) and X1, X2 (which for my particular calculation is just a straight line on the X axis.) What
How to calculate rotation in 2D in Javascript
I am not so familiar trigonometry, but I have only two points to rotate in 2D: cx, cy = rotation center x,y = current x,y nx, ny = new coordinates How to calculate new points in a certain angle? Answer The first two parameters are the X and Y coordinates of the central point (the origin around which the second