Forum Replies Created

Page 8 of 597
  • Actually, to make the upRot the maximum upwards angle, I should have use the sine function… the last line should be like this:

    ease( Math.sin( time * 2 * Math.PI * freq ), -1, 1, upRot, dwnRot )
  • Kevin Camp

    June 16, 2021 at 11:56 pm in reply to: Expression to simulate a pixie flapping it’s wings

    This may work for you, just add it to the rotation axis that you want the wings to rotate on.

    upRot = 45 ;
    dwnRot = -45 ;
    freq = 10 ; // times per sec
    ease( Math.cos( time * 2 * Math.PI * freq ), -1, 1, upRot, dwnRot )

    The upRot and dwnRot values are essentially the min and max rotations for the wings (set as needed). Then adjust the freq of the flapping — according to the internet, a humming bird beats it’s wings between 10 and 80 time a second.

    If you wanted to add some randomness, you can literally add some wiggle() to the end of the last line:

    ease( Math.cos( time * 2 * Math.PI * freq ), -1, 1, upRot, dwnRot ) + wiggle( 5, 10 )

  • In your project settings, go to the expressions tab and make sure the expression engine is set to ‘javascript’

  • Kevin Camp

    May 27, 2021 at 5:47 pm in reply to: Select random layers and change some properties

    Truly random will be tough… you can ask in the expressions forum, but I can’t think of a way to have the opacities or color be both random and follow a rule to use an accurate percentage.

    The only way I can think of would be to use the slider as described above, but then modify the layer order manually to make them random. If you needed the order to change from one usage to another, you could set up several comps and vary the layer orders, then use a slider to control which comp is visible.

    I might be able to come up with another solution, but I’d need to know more about how your icons are arranged.

  • Kevin Camp

    May 26, 2021 at 11:32 pm in reply to: Text Box ‘Bottom Up’ Expression with x-heights?

    since you can’t really use sourceRectAtTime() to derive the height, you could try multiplying the leading by the number of lines.

    this should reposition the text layer’s anchorPoint to be at the baseline of the bottom text line (I am assuming that each line is created with a return):

    txt = text.sourceText ;
    txtLines = txt.split('\r').length ;
    txtLeading = 60 ;
    y = txtLeading * ( txtLines - 1 ) ;
    value + [ 0, y ]

    you will need to manually enter the txtLeading, but we may be able to derive that using style…

    and you’ll have to do something similar to calculate the height for the shape layer, so it looks at the number of lines * the leading rather than sourceRectAtTime().height.

    if I have more time tomorrow, I’ll probably look into it : )

  • Cool… here’s another free product that I just started using to encode to various formats (thanks Walter).

    https://www.shutterencoder.com/en/

  • Kevin Camp

    May 26, 2021 at 5:04 pm in reply to: Select random layers and change some properties

    If you want to effect the opacities of the layers, you can try this:

    Create a null, add a slider to it and then parent all the layers that you want to control with that slider to the null (this will make the expression easier). Make sure the layers are directly below the null that they are parented to as the expression will use each layer’s index in relation to the null’s index to control their opacities.

    Now copy/paste this expression into the layer first below the parent:

    n = thisComp.layer("Null 1").effect("Slider Control")("Slider") ;
    id = index - parent.index ;
    if ( Math.ceil(n) >= id ) { 100 } else { 0 }

    If the slider is 0, the layer opacity should be 0. If the slider is 1 or more, then the opacity should be 100.

    If that works, you can now right-click that layer’s opacity property and choose Copy Expression Only. Then select all the other layers to parented to the null and choose edit>paste the expression into all of them at once.

    The slider should now control the opacities of all the layers sequentially — a 1 value should turn on the firs layer below the null, a 2 should turn on the 2nd layer, etc.

    You can also use a similar expression to control a color control to desaturate a layer. There are a variety of effects that can do that, but Tint is pretty simple, so I’ll outline that here, try this:

    Add the Tint effect to the first parented layer parented below the null and disable the opacity expression by clicking the ‘=’ button for the expression. Then add this expression to the Tint Amount property of the Tint effect:

    n = thisComp.layer("Null 1").effect("Slider Control")("Slider") ;
    id = index - parent.index ;
    if ( Math.ceil(n) >= id ) { 0 } else { 100 }

    Now, rather than changing the opacity when the slider changes, the layer should change from black and white to color when the value is equal or grater than the layer’s index relative to the null.

  • Kevin Camp

    May 25, 2021 at 7:09 pm in reply to: better than ease ?

    Another approach (I use this a lot when I manually adjust velocity curves) is to apply the velocity changes to a slider value to use for timing, then interpolate those values for the result.

    You can apply the slider anywhere, but I often create a null, name it Control and add it there. Keyframe the slider to go from 0 – 1 at the time that you need, then you could adapt your expression like this:

    d = thisComp.layer("Control").effect("Slider Control")("Slider") ;
    xinposition = thisComp.layer("IN").transform.position[0];
    yinposition = thisComp.layer('IN').transform.position[1];
    xoutposition = thisComp.layer('OUT').transform.position[0];
    youtposition = thisComp.layer('OUT').transform.position[1];
    x = linear(d, xinposition, xoutposition);
    y = linear(d, yinposition, youtposition);
    [x,y]

    If you apply your ease and wizz to the slider, or make any other adjustments to the key frame velocities, the layer with the expression should follow the timing of the slider’s velocity.

  • Kevin Camp

    May 24, 2021 at 8:30 pm in reply to: Auto-scale a text line in a multi-line text layer

    I think I’d keep your five separate text layers (one for each line), but link their sourceTexts to a master text layer that the journalists would use to enter text.

    I’d parent each of the separate lines to the master and hide the master (or set opacity to zero), then do a split expression to separate the lines:

    txt = parent.text.sourceText ;
    lines = txt.split('\r') ;
    lines[0] // change 0 to 1, 2, 3, or 4 depending which line of text you want
  • You can make some pretty complex text animations fairly easily using Text Animators and you should find a lot of tutorials on those. They can give you control over properties for individual lines, words and characters. Once set up, they can then be saved as Animation Presets to easily apply when needed.

    I’m not sure how you are getting the text into After Effects (or Illustrator/Photoshop), but Illustrator and Photoshop have some built-in ways to ‘import’ text into layers that you might find useful, try searching ‘data merge’ and either Illustrator or Photoshop to see if it might improve your workflow — it’s a lot like ‘mail merge’ in Word, and there is a bit of setup involved, so it may or may not be worth the effort. Then that .ai or .psd can be easily imported into AE.

    After Effects doesn’t have a built in method to bring text from external files, but you’ll find methods/tutorials that use expressions or scripts to do something similar if you search for ‘after effects text from file’. Again, there is some setup involved, so you’d have to see if that time spent can save you time in the long run.

Page 8 of 597

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