U
U
Umid2017-05-15 20:20:15
JavaScript
Umid, 2017-05-15 20:20:15

How to make line thinning in canvas?

Good evening.
How can I achieve imitation of a line in three-dimensional space.
Those. so that at first the line is wider, and the further, the thinner.
I came up with the idea to write the equation of a straight line using 2 points (the beginning and end of the line), get the coordinates of all points in the range from y1 to y2, and draw a circle at the obtained points, reducing the radius by a certain number.
But maybe there is an easier way?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaly Stolyarov, 2017-05-15
@Ni55aN

It's easier to draw a polygon at the desired coordinates

G
GreatRash, 2017-05-16
@GreatRash

1) If you need 3D simulation, then maybe you need 3D (WebGL)?
2) https://projects.mariusgundersen.net/OnGameStart/#1

X
xmoonlight, 2017-05-15
@xmoonlight

Polygon: an elongated trapezoid.

A
Anvar Shakhmaev, 2017-05-15
@RxR

https://jsfiddle.net/6cnLaqnw/2/
Uses a cylinder as a primitive. In the example, MeshNormalMaterial is chosen for clarity. Take materials from here -
https://threejs.org/docs/#api/materials/Material

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question