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

scale up and down expression

New Here ,
Jun 10, 2019 Jun 10, 2019

Hi,

I'm looking to create an expression that does the same as this opacity expression, which fades in and out, but for scale

fadeInTime = .15; // fade in time (seconds)

fadeOutTime = .15;

Math.min(linear(time,inPoint,inPoint +

fadeInTime,0,100),linear(time,outPoint -

fadeOutTime,outPoint,100,0))

I've tried this but it doesn't work.

fadeInTime = .15;// fade in time (seconds)

fadeOutTime = .15;

Math.min(linear(time,inPoint,inPoint +

fadeInTime,[0,0],[100,100]),linear(time,outPoint -

fadeOutTime,outPoint,[100,100],[0,0]))

this works on it's own for the in but i can't make it work for the out!!

fadeInTime = .15;// fade in time (seconds)

fadeOutTime = .15;

linear(time,inPoint,inPoint +

fadeInTime,[0,0],[100,100])

Can you help?

Thanks

Chris

TOPICS
Expressions
4.6K
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 , Jun 10, 2019 Jun 10, 2019

This should work:

fadeInTime = .15;

fadeOutTime = .15;

if (time < (inPoint+outPoint)/2){

  linear(time,inPoint,inPoint+fadeInTime,[0,0],[100,100]);

}else{

  linear(time,outPoint-fadeOutTime,outPoint,[100,100],[0,0]);

}

Dan

Translate
Community Expert ,
Jun 10, 2019 Jun 10, 2019

This should work:

fadeInTime = .15;

fadeOutTime = .15;

if (time < (inPoint+outPoint)/2){

  linear(time,inPoint,inPoint+fadeInTime,[0,0],[100,100]);

}else{

  linear(time,outPoint-fadeOutTime,outPoint,[100,100],[0,0]);

}

Dan

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
New Here ,
Jun 10, 2019 Jun 10, 2019

Thank you, thank you,

Where was I going wrong?  is it easy to explain?

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 ,
Jun 10, 2019 Jun 10, 2019

The method that you were using relies on a Math.min()  trick that works with single values varying between 0 and 100, but not with arrays, like scale values. You could make that method work like this though:

fadeInTime = .15;

fadeOutTime = .15;

s = Math.min(linear(time,inPoint,inPoint + fadeInTime,0,100),linear(time,outPoint - fadeOutTime,outPoint,100,0));

[s,s]

Dan

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
New Here ,
Jun 10, 2019 Jun 10, 2019
LATEST

Thanks.

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