Everything is working but I (seemingly randomly) keep getting an After Effects error: unsafe operation attempted ( 58 :: 0 ). Occurs in a loop which effectively crashes After Effects. Do I need to put in some sort of if statement to check for something?
targetLayer =thisComp.layer("Controls").effect("B&W Map")("Layer")
samplePoint = transform.position
sampleRadius = [1,1];
above = false;
for (f = timeToFrames();
f>= timeToFrames(inPoint); f--){
t = framesToTime(f);
sampledColor_8bpc = 255 * targetLayer.sampleImage(samplePoint, sampleRadius,true,t);
R = Math.round(sampledColor_8bpc[0]);
if (R>1 ){
above = true; break;
}
}
if (above) time - t else 0
;