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

I have t

New Here ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

I have to update a project made by another workmate, he is not available, he have this character hair bouncing a bit when it moves the head and the hair have this expression and show me this error

Screenshot 2024-05-10 at 10.37.16 AM.png

 

and this is the expression

freq = 3;
decay = 5;
n = 0;
if (numKeys > 0){
 n = nearestKey(time).index;
 if (key(n).time > time) n--;
}
if (n > 0){
 t = time - key(n).time;
 amp = velocityAtTime(key(n).time - .001);
 w = freq*Math.PI*2;
value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}else
 value
freq = 0.2;
amp = 80;
s= amp*Math.sin(freq*time*2*Math.PI);
[s,s];

TOPICS
Error or problem , Expressions , How to

Views

246

Translate

Translate

Report

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 , May 10, 2024 May 10, 2024

Depending on how you have your keyframes set up, this might be more what you're looking for:

freq = 3;
decay = 5;
n = 0;
if (numKeys > 0){
 n = nearestKey(time).index;
 if (key(n).time > time) n--;
}
if (n > 0){
  t = time - key(n).time;
  amp = speedAtTime(key(n).time - .001);
  w = freq*Math.PI*2;
  value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}else
  value

Votes

Translate

Translate
LEGEND ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

Fix the last line to only be [s].

 

Mylenium

Votes

Translate

Translate

Report

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 ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

It looks like that's a scale expression. It should work for rotation if you replace the last two lines with this one:

amp*Math.sin(freq*time*2*Math.PI)

Votes

Translate

Translate

Report

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
New Here ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

@Mylenium and @Dan Ebberts Thanks both of you. I'm still struggling learning expressions. both solutions work to eliminate the error, but both solutions set and awkard angle in the layer I can't change, the hair ends almos vertical hidden behind the character head.

Votes

Translate

Translate

Report

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 ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

Actually, looking at it a little closer, it looks like this expression started out as one thing and has been modified, inconsistently, a time or two so that it's hard to say what the original intention was. How do you want it to work?

Votes

Translate

Translate

Report

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
New Here ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

The top piece of hair is anchored on one side of the head, bounce a bit with the head movements, but actually is a very subtle movement... So I render it without it to meet the time, client don't even notice it, but I get intrigued on how it was made and how to fix it. I have a few rotation keyframes on the movement and the expression it's supposed to help make ot more bouncy... sadly I can share the project 'cause. any of idea?? may be a completely diff expression?

Votes

Translate

Translate

Report

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
New Here ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

Screenshot 2024-05-10 at 2.34.47 PM.png

imagine something like this... left is the initial state and position of the anchor.... after I apply any of your solutions (both give the same result), i looks like the image on the right... and it doesn't move.

Votes

Translate

Translate

Report

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 ,
May 10, 2024 May 10, 2024

Copy link to clipboard

Copied

Depending on how you have your keyframes set up, this might be more what you're looking for:

freq = 3;
decay = 5;
n = 0;
if (numKeys > 0){
 n = nearestKey(time).index;
 if (key(n).time > time) n--;
}
if (n > 0){
  t = time - key(n).time;
  amp = speedAtTime(key(n).time - .001);
  w = freq*Math.PI*2;
  value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}else
  value

Votes

Translate

Translate

Report

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
New Here ,
May 11, 2024 May 11, 2024

Copy link to clipboard

Copied

LATEST

It works perfectly!!!! thanks

Votes

Translate

Translate

Report

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