Answer the question
In order to leave comments, you need to log in
How to create rays of light using JavaScript (canvas, LibCanvas)?
It is necessary to implement the emulation of a beam of light, with the possibility of dynamically changing its length and transparency.
Traditionally, this was done by a banal superposition of particles (for example, circles) on top of each other with a uniform distance from the center and a gradual change in the alpha channel to 0, thus a beam was obtained from, say, 25 circles, and by manipulating their coordinates and alpha channel we control the beam.
But there was a need to make a lot of such rays (a couple of thousand at a time), which greatly affects performance.
Since the behavior of the rays, and hence their length / transparency / direction, are very chaotic - the copy-paste option from the virtual canvas disappears, and such an option would eat up too much memory.
Does anyone know other, more resource-saving methods?
Answer the question
In order to leave comments, you need to log in
Check out www.svgjs.com and raphaeljs.com
these libraries make it a lot easier to develop graphic effects like yours and they have a great community where you are more likely to be answered/suggested the right way or tutorial.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question