Scale and position a layer onto another

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
bkan
Posts: 51
Joined: November 6th, 2013, 8:33 am

Hello,
I try to scale and position a layer (calqueMatte) according to another (monCalque).
It works when the anchor point of my "another layer" (monCalque) is in the center of the layer, but does not work when the anchor point is somewhere else than in the center.
My code is simple as this :

calqueMatte.position.setValue([monCalque.position.value[0],monCalque.position.value[1]]);
//calqueMatte.anchorPoint.setValue(monCalque.anchorPoint.value);
maScaleX = monCalque.width/calqueMatte.width*100;
maScaleY = monCalque.height/calqueMatte.height*100;
calqueMatte.scale.setValue([maScaleX*monCalque.scale.value[0]/100,maScaleY*monCalque.scale.value[1]/100]);
calqueMatte.rotation.setValue(monCalque.rotation.value);

Any idea?

Thanks!
Post Reply