I want to implement a line that grows progressively over time, but it’s not displaying and I’m not sure why.
Hello,
I see 2 problems here :
- You set the first version of the GreasedLine with an empty array (which I guess is triggering the error
logger.ts:107 BJS - [11:45:41]: Setting vertex data kind 'position' with an empty array). You should at least fill the first points just before the first drawLine call :
for (let i = 0; i < growthSpeed; i++) {
currentRenderedPoints.push(fullPathPoints[currentPointIndex]);
currentPointIndex++;
}
- For the color in the
drawLineI don’t get you logic here :
for (let i = 0; i < maxPointsLength; i++) {
if (i < maxPointsLength / 2) {
colors.push(color1);
} else {
colors.push(color2);
}
}
First, in this loop i<maxPointsLength is always true. Second, If you want a bi-color line, you can indeed feed a colors list, but make sure that the color and point list is the same size. Here you are feeding a full colors list with a partial point list, which is not right