Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to write expression in such case-4

Enthusiast ,
Jul 08, 2024 Jul 08, 2024

Hi, 

 

I want to animate somthing. but dnt know how can I do that. I want to take value for position a to b from a trim path animation. but also I want the postion to be above the trim path. I want to make it look like it's floating. wiggle I applied. but I dnt understand how to write the expression. please help. 

 

in blue box green bar animation, I applied the expression. but the box is not above the bar, like the second sceneario. How can I make the box take its position value from trim path and also remain to be above. thank you. 

 

wiggle.gif

 

TOPICS
Expressions
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 08, 2024 Jul 08, 2024

I think I try something like this:

yOffset = -100;
L = thisComp.layer("Line");
p = L.content("Shape 1").content("Path 1").path;
w = wiggle(3,5) - value;
L.toComp(p.pointOnPath(L.content("Shape 1").content("Trim Paths 1").end/100)) + [0,yOffset] + w

You could certainly replacye the Trim Paths End point with a slider if you want to.

Translate
Community Expert ,
Jul 08, 2024 Jul 08, 2024

I think I try something like this:

yOffset = -100;
L = thisComp.layer("Line");
p = L.content("Shape 1").content("Path 1").path;
w = wiggle(3,5) - value;
L.toComp(p.pointOnPath(L.content("Shape 1").content("Trim Paths 1").end/100)) + [0,yOffset] + w

You could certainly replacye the Trim Paths End point with a slider if you want to.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 08, 2024 Jul 08, 2024

 

 

Hi Dan, Thank you so much. I did it!! I screamed so loud outta happiness that I think International Space Station's astronuts cud hear me. Thank you. this is so cute.

 

 

dan.gif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 08, 2024 Jul 08, 2024

Hi Dan,

 

am experimenting. why the expression is not working now?

 

dan 2.gif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2024 Jul 08, 2024

I'm not sure what you're after exactly, but maybe this:

offset = -100;
L = thisComp.layer("Line");
p = L.content("Shape 1").content("Path 1").path;
w = wiggle(3,5) - value;
newP = L.toComp(p.pointOnPath(L.content("Shape 1").content("Trim Paths 1").end/100));
v = p.normalOnPath(L.content("Shape 1").content("Trim Paths 1").end/100);
newP + v*offset + w

You might have to change the sign for offset, depending on how you drew the path.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 09, 2024 Jul 09, 2024

Hi Dan,

 

I tried the xpression, it didnt work. I think for closed path it dsnt work. am so sad now. feel like am lost :'(

 

 

 

 

dan 4.gif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 09, 2024 Jul 09, 2024

dan 3.gif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 09, 2024 Jul 09, 2024

It looks like you left out the 6th line of the expression:

v = p.normalOnPath(L.content("Shape 1").content("Trim Paths 1").end/100);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 10, 2024 Jul 10, 2024

 

Yes, My bad. I tried again. it works now, but the ball seems intoxicated. it forgets what it shud follow. 

 

dan.gif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2024 Jul 10, 2024

There's definitely something strange going on there. Could you possibly post the project file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 10, 2024 Jul 10, 2024

here it is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2024 Jul 10, 2024

I think it's because for the line, you have Transform Shape 1 Scale not set to 100%,100%. If you change it to 100%, you'll also need to change the offset variable in the expression from -100 to 100 to get the ball on the outside of the line.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 10, 2024 Jul 10, 2024

Hi,

 

Now I set both 100,100 (scale), but its more bizzare 😮 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2024 Jul 10, 2024

You need to change the first line of the expression to be:

offset = 100;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 10, 2024 Jul 10, 2024
LATEST

😮😮now it works!!! 😮 😮 THANK YOU SO MUCH. 😮 😮 😮

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines