-
Slow Code
Hi all.
Can anyone shed any light on why the function below in an expression causes very slow render times?
Any help would be massively appreciated.
Thanks,
Jamie//
// this function returns an array of [prevMarkerIndex, prevMarkerTime, nextMarkerIndex, nextMarkerTime] for markers on any given layer.
function getMarkerInfo(mLayer1) {
if (mLayer1.marker.numKeys > 0) {
nearestMarker = mLayer1.marker.nearestKey(time);
prevMarkerIndex = nearestMarker.index - (nearestMarker.time > time);
if (prevMarkerIndex < mLayer1.marker.numKeys) {
nextMarkerIndex = prevMarkerIndex + 1;
} else {
nextMarkerIndex = prevMarkerIndex;
}
if (prevMarkerIndex == 0) {
prevMarkerTime = 0;
} else {
prevMarkerTime = mLayer1.marker.key(prevMarkerIndex).time;
}
nextMarkerTime = mLayer1.marker.key(nextMarkerIndex).time;
} else {
prevMarkerIndex = 0;
prevMarkerTime = 0;
nextMarkerIndex = 0;
nextMarkerTime = 0;
}
return [prevMarkerIndex, prevMarkerTime, nextMarkerIndex, nextMarkerTime];
}JimJam•Graphics
https://www.jimjamgraphics.com/