i am having very big railway track as path in svg path...but i want to divide the track into 4 and display one by one...please suggest me a code in angular
i tried by splitting the values into 4 and marked the coordinate but it results missing line in previous track kindly help me with other solution
<path *ngFor="let path of part1" [attr.d]="path" fill="none" stroke="black" stroke-width="5">
<path *ngFor="let path of part2" [attr.d]="path" fill="none" stroke="black" stroke-width="5">
TS:
const splitData = this.final;
const chunkSize = Math.ceil(splitData.length / 4);
this.part1 = splitData.slice(0, chunkSize);
this.part2 = splitData.slice(chunkSize, 2 * chunkSize);
this.part3 = splitData.slice(2 * chunkSize, 3 * chunkSize);
this.part4 = splitData.slice(3 * chunkSize);
"I want to divide the track into 4 and display one by one..."
So you need execute a function 4 times pausing a bit until execute two consecutive call to the function
For this you can use rxjs
Well, if you want to draw "bit a bit" a svg the first is divided the svg in parts
If you want to draw "bit a bit" it's easy
where
stackblitz
To calculate the position initial of each Pat it's more difficult. I suggest you calculate the different paths and save in a file.
You can change a bit the timer to makes Angular makes the calculate for us