-
shape layers: keep stroke width inside a scaled group?
Hi! I’m getting mad with this close-to-but-always-getting-errors workaround…
I have a shape layer with 4 lines (one group each, with its own stroke, and trim paths) so the 4 are: right, left (both vertical) and top, bottom (both horizontal), and as they are crossing themselves they create a square/rectangle.
The 4 lines are inside a group, called “lines”. And on its scale I added this expression:
l=effect("selected")("Layer")
w=l.sourceRectAtTime().width;
h =l.sourceRectAtTime().height;
[w,h]so it wraps whatever selected layer I want. And with the trim paths, it makes an animated outlined effect to create a mini grid.
The problem is, as the group is being scaled, the strokes got awfully scaled too…
I’m using this expression to keep its consistency, but I don’t know how to change it to make it keep its scale also when the group they are in is re-scaled..
var zCorrect;
try{
var cam = thisComp.activeCamera;
var camWS = cam.toWorld(cam.transform.pointOfInterest);
zCorrect = -1*(fromWorld(camWS)[2] - position[2])/cam.cameraOption.zoom;
}
catch(err){
zCorrect = 1;
}
var w = thisComp.layer("control").effect("line width")("Slider");
var newScale = trueScale(thisLayer,scale[1]);
val = w*zCorrect*100/newScalefunction trueScale(layer,sc){
if(layer.hasParent){
return trueScale(layer.parent,sc*=(layer.parent.scale[0]/100));
}
else{
return sc;
}
}is that doable?
(or maybe another workaround for the thing?)thanks!