-
Expression syntax problems – FOR loop
Hi guys, please help me with this code.
I’m beginner with coding and I’m sure I have made a mistake with the syntax.
I’m trying to find out with “c” variable how many pixels are from the end of the layer to the text itself, using sampleImage and moving the target point. I’ve tried to make a loop and for every pixel that have the sampleImage [0,0,0,0] result add 1 to counter c that had the initial value 0. Also, when the first pixel with no transparency is encountered I want the loop to break.c=0;
for(x=1920;x==0;x--){
y=659;
t=thisComp.layer("Text 1");
r=t.sampleImage([x,y],[1,1]);
if(r==0) {c=c+1} else break;
};
c