Forum Replies Created

Page 1 of 2
  • Philip Neves

    June 21, 2017 at 6:13 pm in reply to: Changing Scale of Child relative to Parents H/W

    Missed the cross-post, anyway.

    Dan Ebbert’s solution is probably better (not a huge surprise)… mine has issues when you animate and it crosses over from scaling based off one dimension to scaling based on the other.

    https://forums.creativecow.net/thread/227/36108

  • Philip Neves

    June 21, 2017 at 5:57 pm in reply to: Changing Scale of Child relative to Parents H/W

    That’s a cool effect and I want to steal it. ☺

    I played with it and put something together that might be similar what you want. (You may have to adapt things for your project layout though — mostly because I didn’t understand what your slider was doing.)

    In a comp with a 1920×1920 (or other square) solid and a centered text layer as a child:

    1. Add two Slider controls to the solid named “h” and “w” with values of 100.
    2. Add this expression to the solid’s scale:


    h = effect("h")("Slider");
    w = effect("w")("Slider");
    [w,h]

    3. Add this expression to the text layer’s scale:


    w = parent.scale[0];
    h = parent.scale[1];
    xfac = (w)/100;
    yfac = (h)/100;
    q = Math.min(xfac,yfac)

    s1 = 100*value[0]/w*q;
    s2 = 100*value[1]/h*q;

    [s1,s2]

    The text layer will scale uniformly with the smallest dimension of the solid and retain its position relative to the solid. You can shift the solid’s anchor point to have it scale from a side instead of the center.

    Helpful, or missing the point?

  • Glad it worked.

    I can try, but I’m not great at either coding or explaining.


    -parent.transform.rotation

    For this one we want to cancel the rotation of the parent. If the parent rotates 60 degrees, we rotate 60 the other way. So this just says “get the rotation of the parent” and puts a minus sign in front of it to invert it. 60-60 = 0 = no rotation.

    It’s a little flawed, because it will always equal 0, and some time you may want to add some rotation on purpose. So it could be rewritten this way:


    value-parent.transform.rotation

    or

    -parent.transform.rotation+value

    “value” is null’s original rotation value. This will add any rotation you’ve already applied to the null back, while canceling parent rotation.

    —-


    s = 100*transform.scale[0]/parent.transform.scale[0];
    [s,s]

    To reverse parent scale, we can’t just flip the sign, we have to invert the number. If your parent null scales up 4x…

    4*100 = 400

    then you would want to scale down 1/4x to cancel.

    1/4*400 = 100

    In that expression, we grab the x scale of your null (transform.scale[0]) and divide it by the parent’s x scale (parent.transform.scale[0]) and multiply by 100 to convert it from a percent (.25) to the whole number (25) that AE is expecting.

    Sidebar: When you pull a scale property, you don’t get one number, you get two, like [100,100]. When you write scale[0] you’re just grabbing the first one (computers start counting at 0. I made an assumption your scale would be the same in both dimensions.

    “s =” assigns the value to a variable we just made up named “s”.

    This is so that on the next line we can give it to After Effects in the two-number format it expects: [s,s]. If you give it just one number it will yell at you.

    This expression also has a flaw — if your parent scale is 0, it’ll divide by zero and stop working. So don’t do that.

    —-


    L = thisComp.layer("Null");
    L.toComp([0,0,0])

    I grabbed this from someone else. I don’t fully understand toComp, but I’ll try my best:

    toComp is a method that transforms points from layer space to composition space. We feed it a point and it gives us back a point that’s corrected.

    If you have a solid that’s rotated, scaled, and repositioned, or is in 3D, 960×540 on the layer won’t be in the same place as 960×540 in the comp. toComp([0,0,0]) will correct for that and return a value that compensates for those things.

    It could also be written:

    thisComp.layer("Null").toComp([0,0,0])

    …but assigning the layer to a variable and using the method on the variable (L.toComp()) is a good habit because if you’re writing longer expressions, you don’t have to replace the target “thisComp.layer(“Null”)” in five different places if it ever needs to be changed.

    Here’s some resources that may help explain things:

    https://www.youtube.com/watch?v=ORNM_7jqZCI — Reversing parent rotation
    https://www.youtube.com/watch?v=iu-tKxsSHbQ — Beam and toComp
    https://www.motionscript.com/mastering-expressions/lst-lens-flare.html — Layer Space Transforms

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Philip Neves

    June 20, 2017 at 3:55 pm in reply to: Dancing pixels – vector graphics

    Just realized you’re using Brush Strokes, which I think is animated by default. Maybe that’s the problem, not the position. Read up on how to get the effect you want in Brush Strokes while freezing it. This may or may not help.

    https://forums.creativecow.net/readpost/2/1114165

  • Oh, and I’m not sure I understand what you’re doing with anchor points… so these expressions might not work perfectly for you since they’re position-based.

  • Philip Neves

    June 20, 2017 at 3:37 pm in reply to: Dancing pixels – vector graphics

    Would precomping the SWF and just that effect help? Within the precomp, it won’t move, so it shouldn’t flicker.

  • Beams are tricky because they work with the position in their own layer instead of in the comp. So we’re in the wonderful world of layer space transforms.

    If you don’t need the beam to be adaptive to different positions, precomp that effect & layer together.

    If you do need it to adapt, you could try mapping the beam to the positions of your objects. Unparent the beam layer, center and unrotate it again, and write an expression for the start point on the beam that looks like this:


    L = thisComp.layer("Null");
    L.toComp([0,0,0])

    …where the first line targets the null (you’ll need to correct it to the right name), and the second line adapts the null’s position to the corresponding position on your layer. If I did it right.

    You’d then need to repeat this for the beam’s end point, which will need a target — maybe just add another null, parented to the first null.

    https://www.motionscript.com/mastering-expressions/lst-lens-flare.html

  • Philip Neves

    June 20, 2017 at 1:46 pm in reply to: Trim Paths on shape to match size of text

    Here’s one possible solution:

    1. Make your line shape layer the width of the comp (because I don’t know how to get the length of a line).
    2. Apply this expression to the line’s scale:


    s=thisComp.layer("Text");
    pad = 0;
    line = s.sourceRectAtTime(time,true).width+pad;
    q = 100*(line/thisComp.width);
    [q,100]

    3. Change the “s” variable to target your text layer.
    4. Animate Trim Paths Start and End properties in whatever way you prefer.

    You can change the pad variable in that expression to add some extra length to each side of the line.

    Does that work?

  • There are probably really sophisticated ways to nail a null to an outline, but I don’t know what they are and you said you only need a circle. So here’s how I would try it.

    1. Create a circle shape layer with the dimensions 200,200 and centered.
    2. Move your null to the edge of the circle (so if it was centered at 960,540, it will be at 1060,540)
    3. Parent the null to the circle.
    4. Put this expression on the null’s rotation to maintain rotation while the parent rotates:

    -parent.transform.rotation

    5. Put this expression on the null’s scale to maintain scale while the parent scales:

    s = 100*transform.scale[0]/parent.transform.scale[0];
    [s,s]

    6. Rotate and scale the circle. The null should rotate in a circle without rotating itself, and the scale should make the circle larger without scaling the null. You can now match the circle to your target’s position and size.
    7. You can now hide the circle (or replace it with a null… it’s just a circle as a visual aid. Or with the target if that’s intended to move.) Tracking data can get sent to the circle, or you can put another null parent in the chain above the circle if shifting anchor points becomes a problem.

    Does this help you or did I misunderstand what you were asking?

  • There should be a shortcut to type a bracket no matter what layout your keyboard is — you just need to find it online.

    Or, you could try editing your shortcuts file to change the bracket shortcuts to something easier for you to use. (They’re very helpful shortcuts).

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy