Movimiento restringido

  • hace 14 años
Procedimiento
1. Crear composición.
2. Crear capa de sólido cuadrada pequeña.
5. Agregar la siguiente expresión en la propiedad posición de la capa de sólido:
seedRandom(100, timeless =true);
velocidadX=random(300);
velocidadY=random(300);
x=velocidadX*time;
y=velocidadY*time;
w=thisComp.width-thisLayer.width;
h=thisComp.height-thisLayer.height;
nx=Math.floor(x/w)%2;
ny=Math.floor(y/h)%2;
residuoX=x%w;
residuoY=y%h;
if (nx==0) x=residuoX else x=w*nx-residuoX;
if (ny==0) y=residuoY else y=h*ny-residuoY;
[thisLayer.width/2+x,thisLayer.height/2+y]