P
P
Pavel Antonov2016-08-04 11:43:18
css
Pavel Antonov, 2016-08-04 11:43:18

By what principle does the transparency of the lines change?

I would like to control the transparency parameter of lines or their number (the number is not on the screen, but between two points. There is a suspicion that the brightness of the lines depends on the fact that they are drawn not one between points, but two or more). When hovering the mouse, the lines change their transparency. Perhaps transparency does not appear there at all, but two or more lines are drawn depending on the position of the points and the mouse.
An example is here codepen.io/freislot/pen/YWJyKJ
Here is what I found along the lines

if (
              (iStar.x - jStar.x) < config.distance &&
              (iStar.y - jStar.y) < config.distance &&
              (iStar.x - jStar.x) > - config.distance &&
              (iStar.y - jStar.y) > - config.distance
            ) {
              if (
                (iStar.x - config.position.x) < config.radius &&
                (iStar.y - config.position.y) < config.radius &&
                (iStar.x - config.position.x) > - config.radius &&
                (iStar.y - config.position.y) > - config.radius
              ) {
                context.beginPath();
                context.moveTo(iStar.x, iStar.y);
                context.lineTo(jStar.x, jStar.y);
                context.stroke();
                context.closePath();
              }
            }

As I understand it, when these conditions are met, lines are drawn, but by what principle a second line appears in the same place, I did not figure it out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GreatRash, 2016-08-04
@GreatRash

Transparency is different because there are several of them overlapping each other.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question