I made a scripted expression for after effects a while ago. This script is preventing objects to lay on odd pixels when a Keyframe is applied.// Amount of Keyframesn = transform.position.numKeys;// Timet = time;// Time of KeyframetimeOfKeyframe = null;if ( n != 0 ){     // Time of first Keyframe     timeOfFirstFrame = transform.position.key(1).time;     // Time of last Keyframe     timeOfLastFrame = transform.position.key(n).time;}else{     timeOfFirstFrame = null;     timeOfLastFrame = null;}if ( n == 0 || t < timeOfFirstFrame || t > timeOfLastFrame ){     posX = Math.round(transform.position[0]);     posY = Math.round(transform.position[1]);     posZ = Math.round(transform.position[2]);     [posX,posY,posZ];}else{     for(i=1; i <= n; i++){          if ( t == transform.position.key(i).time ){               timeOfKeyframe = transform.position.key(i).time;          }          else{               value;          }     }     if (t == timeOfKeyframe) {          keyValue = transform.position.valueAtTime(timeOfKeyframe);          roundedValue = [Math.round(keyValue[0]),Math.round(keyValue[1]),Math.round(keyValue[2])];     }     else{          value;     }}It's working for three dimensional objects. Since I am actually not a real programmer I wanted to know if there is any better way to achieve this. It seems to be a very long expression.
After effects expression to prevent objects to lay on odd pixels when a Keyframe is applied
javascript;beginner;coordinate system