Page 1 of 1

Scale and position a layer onto another

Posted: September 18th, 2014, 8:13 am
by bkan
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!