Steve Sierra
Forum Replies Created
-
Hi,
You can put this in your slider exprexxion :
parseInt(thisComp.layer(“1”).text.sourceText);
Hope this works,
Cheers ! -
Steve Sierra
October 23, 2018 at 8:20 am in reply to: How to resize an existing shape layer using Scripts?Hi,
You should check out redefinery.com, he has a free script called prop path I think which will give you the path to any property in any type of scripting/expression language !
His tutorials are great too ????https://www.redefinery.com/ae/rd_scripts/
Cheers !
-
Hi Kalleheikki,
Thank you very much ! This works perfectly .
I had just found a workaround : I just offset the rectangle 2 Anchor point to its top/center. I then just have to change the skew amount ????Thanks again for your time.
Best regards,S.
-
-
Steve Sierra
March 21, 2018 at 11:44 am in reply to: Select property only in certain property groupsThanks for the explanation Andrei ! Could come in handy some time…
Good luck with your project Florian 😉 -
Steve Sierra
March 20, 2018 at 11:06 am in reply to: Select property only in certain property groupsHi,
I’d use slice to get only the “stroke” part of the property name.
it goes:
prop.name.slice(the character you want to start slicing at , the character you want to finish slicing at);In your case, slice(0,6) I think…
Hope this helps !
By the way, what is the difference betxeen “==” and “===” ? 😉 -
Steve Sierra
March 15, 2018 at 4:59 pm in reply to: Is it possible to return a layer from a function ?Hi Andrei,
Thanks for your reply !
Taking BpreNull out of the function arguments works just fine.
Thanks also for explaining ????Cheers !
-
Hi again,
Ok, I think I got it…
Here’s a recap :
Let’s say you have layer(“Alayer”) in “Acomp”.
in “Bcomp”, you have layer(“Acomp”) and layer(“Blayer”).
“ALayer’s” AnchorPoint and Position have to be set at the center of the comp.
No parenting anywhere.If you want to drive layer(“Alayer”) with layer(“Blayer”),
regardless of :
-“Acomp” and “Bcomp” size difference
-layer(“Acomp”)’s pos, scale, rot and anchor point’s locationput this expression in the Anchor Point property of “Alayer” :
//Raw Variables
AcompLayer=comp(“Bcomp”).layer(“Acomp”);
d = AcompLayer.transform.anchorPoint;
s = AcompLayer.transform.scale;
h = AcompLayer.transform.position;
g = comp(“Bcomp”).layer(“Blayer”).transform.position;
//
//Counter Scale
function CounterScale(Pos, s){
return [Pos[0]*100/s[0], Pos[1]*100/s[1]];
};
a = CounterScale(h, s);
b = CounterScale(g, s);
c = fromWorld(a) – fromWorld(b);
scaledPos = d + c;
//
//Counter Rotation
preRot = -AcompLayer.transform.rotation;
eRot = degreesToRadians(preRot);
eCos = Math.cos(eRot);
eSin = Math.sin(eRot);
u = scaledPos – d;
x = eCos*u[0] – eSin*u[1];
y = eSin*u[0] + eCos*u[1];
[(d[0] + x), (d[1] + y)];Put this in “Alayer’s” Scale property :
//Counter Scale
a = comp(“Bcomp”).layer(“Blayer”).transform.scale;
b = comp(“Bcomp”).layer(“Acomp”).transform.scale;
c = [a[0] * 100 / b[0], a[1] * 100 / b[1]];
//
//Add Controller Scale
d = comp(“Bcomp”).layer(“Blayer”).transform.scale;
[c[0] * d[0] / 100, c[1] * d[1] / 100];And this in “Alayer’s” Rotation property :
a = comp(“Bcomp”).layer(“Blayer”).transform.rotation;
b = comp(“Bcomp”).layer(“Acomp”).transform.rotation;
a – b; -
Oops, forgot a comma :
preCompLayer=comp(“MasterComp”).layer(“PreCompLayer”);
a = preCompLayer.transform.position;
s = preCompLayer.transform.scale;
b = comp(“MasterComp”).layer(“MasterLayer”).transform.position;
d =[comp(“PreComp”).width/2, comp(“PreComp”).height/2];
c = fromWorld(a)-fromWorld(b);
lightPos=d-c;
preRot= -preCompLayer.transform.rotation;
eRot=degreesToRadians(preRot);
eCos=Math.cos(eRot);
eSin=Math.sin(eRot);
u=lightPos-d;
x=eCos*u[0]-eSin*u[1];
y=eSin*u[0]+eCos*u[1];
[d[0]+x, d[1]+y]; -
Hello again,
I made a few changes: instead of the “MaskedLayer” position, I used the center of “PreComp”. (I’m thinking I should maybe use “PreCompLayer”s anchorPoint ?)
I managed to get both position and rotation to work, but I still can’t figure out how to incorporate “preCompLayer” scale changes.
I think I have to use preCompLayer’s scale and maybe the size ratio between MasterComp andPreComp in my expression… but I don’t know where and how ?Any help would be greatly appreciated !
Here’s my new expression for PreCompNull’s position:preCompLayer=comp(“MasterComp”).layer(“PreCompLayer”);
a = preCompLayer.transform.position;
s = preCompLayer.transform.scale;
b = comp(“MasterComp”).layer(“MasterLayer”).transform.position;
d =[comp(“PreComp”).width/2comp(“PreComp”).height/2];
c = fromWorld(a)-fromWorld(b);
lightPos=d-c;
preRot= -preCompLayer.transform.rotation;
eRot=degreesToRadians(preRot);
eCos=Math.cos(eRot);
eSin=Math.sin(eRot);
u=lightPos-d;
x=eCos*u[0]-eSin*u[1];
y=eSin*u[0]+eCos*u[1];
[d[0]+x, d[1]+y];

