Forum Replies Created

Page 44 of 277
  • Filip Vandueren

    March 7, 2022 at 12:10 pm in reply to: Scripting – Centre Mask on Shape Layer

    Hi Liam, shape layers and textlayers – because they are rasterized continuosly- behave as if they always are a composition-sized layer.

    Using an exprerssio with sourceRectAtTime(), you can get the correct dimensions, although for some shapes it may or may not include the stroke-width.

    For example, see this question from yesterday:

    https://creativecow.net/forums/thread/mask-path-shape-to-always-match-text-total-scale-and-width/

    Mask Path Shape to always match text total scale and width

  • Filip Vandueren

    March 7, 2022 at 12:05 pm in reply to: multidimensional array – simple maths stuff?

    Oops, I think I misunderstood your question, Frank.

    You already got it working with a for loop (I thought you were asking why your expression wasn’t working, but it was)

    But you are wondering if there’s another way to work through these arrays.

    Here’s a version that uses Array.map() and arrow functions to make manipulated copies of arrays:

    if ( numKeys > 0 && time > key(numKeys).time) {

    //continue out

    keyframeTime = key(numKeys).time;

    offsetKeyframeTime = keyframeTime - framesToTime(1);

    framesMultiplier = timeToFrames(time - keyframeTime);

    pointsArray = thisProperty.points();

    deltaPoints = pointsArray.map( (el, ind) => sub(el,thisProperty.points(offsetKeyframeTime)[ind]) );

    inTangentsArray = thisProperty.inTangents();

    deltaInTangents = inTangentsArray.map( (el, ind) => sub(el,thisProperty.inTangents(offsetKeyframeTime)[ind]) );

    outTangentsArray = thisProperty.outTangents();

    deltaOutTangents = outTangentsArray.map( (el, ind) => sub(el,thisProperty.outTangents(offsetKeyframeTime)[ind]) );

    pointsArray = pointsArray.map( (el, ind) => el + mul(deltaPoints[ind],framesMultiplier));

    inTangentsArray = inTangentsArray.map( (el, ind) => el + mul(deltaInTangents[ind],framesMultiplier));

    outTangentsArray = outTangentsArray.map( (el, ind) => el + mul(deltaOutTangents[ind],framesMultiplier));

    pathClosedState = thisProperty.isClosed();

    createPath( points = pointsArray , inTangents = inTangentsArray , outTangents = outTangentsArray , isClosed = pathClosedState);

    } else {

    value;

    }

  • Filip Vandueren

    March 7, 2022 at 11:40 am in reply to: multidimensional array – simple maths stuff?

    Hi Frank, al that’s needed is to change the last line into:

    else { value }

    1-line else statements are buggy in the new Javascript engine, so it’s best to avoid them.

    But the code works for me as is

  • Filip Vandueren

    March 6, 2022 at 10:43 pm in reply to: Finding all the text layers in whole project.

    That will only be possible with a script.

    Are you trying to search and replace ? Or change the font of everything ?

  • Filip Vandueren

    March 6, 2022 at 10:39 pm in reply to: Randomize slider every 30 frames

    Hello Nihad,

    maybe something like this: (expression on the slider controller)

    seedRandom(index,true);

    values=[1,2,3,4,5];

    if (effect("Random")("Checkbox").value == true) {

    i=0;

    t=timeToFrames(time/30); // change every 30 frames

    // get non repeating random numbers

    for (j=0; j<t; j++) {

    i+=1+Math.floor(random(values.length-1));

    }

    output = values[i%values.length];

    } else {

    output = Math.floor(clamp(value, min=1, max=5));

    }

    output;

  • If you’re interested, here’s why there’s a multiplication by .55:

    https://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves

  • Correct, for example like this:

    padding = 15;

    rounding = 30;

    curviness = 1; // 0=chamfer, 1=rounded

    tangentLength = rounding * curviness*.55;

    sr=sourceRectAtTime();

    pts = [

    [sr.left-padding, sr.top-padding+rounding],

    [sr.left-padding+rounding, sr.top-padding],

    [sr.left+sr.width+padding-rounding, sr.top-padding],

    [sr.left+sr.width+padding, sr.top-padding+rounding],

    [sr.left+sr.width+padding, sr.top+sr.height+padding-rounding],

    [sr.left+sr.width+padding-rounding, sr.top+sr.height+padding],

    [sr.left-padding+rounding, sr.top+sr.height+padding],

    [sr.left-padding, sr.top+sr.height+padding-rounding],

    ];

    in_Tangents = [

    [0,0],

    [-1,0]*tangentLength,

    [0,0],

    [0,-1]*tangentLength,

    [0,0],

    [1,0]*tangentLength,

    [0,0],

    [0,1]*tangentLength

    ];

    out_Tangents = [

    [0,-1]*tangentLength,

    [0,0],

    [1,0]*tangentLength,

    [0,0],

    [0,1]*tangentLength,

    [0,0],

    [-1,0]*tangentLength,

    [0,0]

    ];

    createPath(pts,in_Tangents,out_Tangents,true);

  • Hi Craig.

    Give the mask this expression:

    sr=sourceRectAtTime();
    pts= [
    [sr.left, sr.top],
    [sr.left+sr.width, sr.top],
    [sr.left+sr.width, sr.top+sr.height],
    [sr.left, sr.top+sr.height],
    ];
    createPath(pts,[],[],true);
  • Filip Vandueren

    March 4, 2022 at 9:48 am in reply to: ae text animator target text

    Yes, in theory that’s possible with a text-animator with expression selector that controls “Character offset”. The sentences would need to have the same amount of characters.

    One thing you’ll run into is that spaces get ignored by the character offset animators… they always stay a space. Bummer. Unfortunately it extends to all kinds of spaces, so there’s no fooling the animator by replacing spaces with more exotic variations such as em-spaces or non-breaking-spaces etc.

    The only workaround would be to substitute the spaces with underscores, or macron-characters, and then do an extra animator that sets the opacity of those characters to 0, if they haven’t already morphed… You can see that’s spiralling into something complex rather quickly.

    It’s maybe easier to do it with an expression on the sourceText instead of an animator though.

    For example:

    str1= "From bedrooms to";
    str2= "to broken hearts";
    output="";
    for (i=0; i<str1.length; i++) {
    c1=str1.codePointAt(i);
    c2=str2.codePointAt(i);
    anim=linear(time-i/str1.length, 1,2, c1,c2)
    output += String.fromCodePoint(Math.floor(anim));
    }
    output;
  • Hi Andy, checking that is possible with:

    thisLayer.hasParent

Page 44 of 277

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