Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 16x 16x 16x 16x 1894x 160x 1734x 256x 1478x 252x 1226x 16x 16x | /**
* Returns a re-ordered array consisting of, in order:
* 1. First few objects
* 2. Center objects
* 3. Last few objects
* 4. nth Objects (n=7), set 2
* 5. nth Objects set 5,
* 6. Remaining objects
* What this does is return the first/center/start objects, as those
* are often used first, then a selection of objects scattered over the
* instances in order to allow making requests over a set of image instances.
*/
export default function getNthFrames<T>(imageIds: T[]): T[] {
const frames: T[][] = [[], [], [], [], []];
const centerStart = imageIds.length / 2 - 3;
const centerEnd = centerStart + 6;
for (let i = 0; i < imageIds.length; i++) {
if (i < 2 || i > imageIds.length - 4 || (i > centerStart && i < centerEnd)) {
frames[0].push(imageIds[i]);
} else if (i % 7 === 2) {
frames[1].push(imageIds[i]);
} else if (i % 7 === 5) {
frames[2].push(imageIds[i]);
} else {
frames[(i % 2) + 3].push(imageIds[i]);
}
}
const ret = [...frames[0], ...frames[1], ...frames[2], ...frames[3], ...frames[4]];
return ret;
}
|