Sair
  • Comunidade global
    • Idioma:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

how to change trim path value

Entusiasta ,
Nov 25, 2023 Nov 25, 2023

Hello,

I want to animate a digit with a circle. I want the digit to go from 0 to 20 and simultaneously complete the full trim path circular animation from 0 to 20.

I animated the digit animation with slider control.

I applied trim path to the stroke and also applied angle control to the circle.. and whipped trim path ‘end’ to the angle control so that I can animate it from 0-20 and want circle complete it’s trim path animation from 0-20. (0 first keyframe, last keyframe is 20 in angle control)

but it’s not happening.

At 20 (last key frame) the trim path animation stops.

I understand that trim path value is 100. So to make it a full rotation I must do something so that after effects can make that 100 into ‘20’ .

What is that ‘something’ I can’t figure out.. Google has nothing to offer. Please help. I am so sad.

 

 

trim.giftrim2.gif

1.3K
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines

correct answers 1 resposta correta

Community Expert , Nov 25, 2023 Nov 25, 2023

Add an Expression Control to your text layer. Add an expression to the source text that ties the value of the slider to the text and use toFixes() to limit the number of decimal places. Set some keyframes for the slider with the first zero and the last 20.  Add another expression to the end value that ties the completion to a slider and add linear interpolation to link the start and end values to toe completion of trim paths.

//Text Layer/Source Text
v = effect("Slider Control")("Slider").value;
...
Traduzir
Community Expert ,
Nov 25, 2023 Nov 25, 2023

Add an Expression Control to your text layer. Add an expression to the source text that ties the value of the slider to the text and use toFixes() to limit the number of decimal places. Set some keyframes for the slider with the first zero and the last 20.  Add another expression to the end value that ties the completion to a slider and add linear interpolation to link the start and end values to toe completion of trim paths.

//Text Layer/Source Text
v = effect("Slider Control")("Slider").value;
v.toFixed();

//Shape Layer/Trim Paths/End
t = thisComp.layer("Text Layer").thisComp.layer("Text Layer").effect("Slider Control")("Slider");
linear(t, 0, 20, 0, 100)

 

Completion.gif

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Nov 26, 2023 Nov 26, 2023

Hi Rick,

 

I have never been so happy. Thank you so much. I am sooo happy. Thank you. been struggling with this for hours...

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Community Expert ,
Nov 27, 2023 Nov 27, 2023

I'm glad I could help.

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Novato ,
Jun 26, 2024 Jun 26, 2024

Hello Dear Rick,

 

I have another big problem please help me, I have a Decimal Number Counter that is control by an Angle Controller, so I Want to animate a Line with shape layer and trim path, So I connected the end of trim path to the Layer controller, but the problem is here, My number is bigger than 100 and the shape layer animation doesn't work with numbers bigger than 100.

 

I appreciate it if you could help me here's is the Project file link

 

Problem.gif

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Community Expert ,
Jun 26, 2024 Jun 26, 2024
MAIS RECENTE

It looks like you are converting an angle into dollars and cents and then trying to use that to drive the end value for Shape 1/Trim Path 1/End. 

 

I would have approached the problem by using a Slider Control instead of the rotation control so you could easily see the value you want to display instead of multiplying the rotations by 360 and then adding the angle. This would eliminate the math problem. 

 

Your example also has three keyframes for rotation. You could use a keyframe value to drive a linear interpolation method, but you would need to know the number of the keyframes to retrieve a tMax value.

 

This expression should work if you have 3 keyframes for Angle:

 

 

t = thisComp.layer("<empty text layer>").effect("Counter")("Angle");
tMin = 0;
tMax = t.key(3).value;
linear(t, tMin, tMax, 0, 100);

 

 

Unfortunately, there is no function that will return the value of the last keyframe in the timeline, so you'll have to edit the t.key ().value line to reflect the total number of keyframes for Rotation each time you use this expression (Slider would be simpler).

 

I would have used a different expression for Text/Source Text. If you animate (keyframe) the Trim Paths/End value and add an expression control slider to give you the maximum value you want, this expression will do the trick.

 

 

t = thisComp.layer("Shape Layer 2").content("Shape 1").content("Trim Paths 1").end;
maxVal = effect("Slider Control")("Slider");
val = linear(t, 0, 100, 0, maxVal);
num = "$ "+ val.toFixed() + "";

function addCommas(x) {
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
addCommas(num)

 

 

This simplifies the project. You only need one expression for the text layer, an Expression Control Slider Control to set the maximum value, and some keyframes for the Shape Layer/Contents/Shape 1/Trim Path/End property.

 

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines