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

Animate object every second according to set values?

Participant ,
Oct 03, 2011 Oct 03, 2011

OK, so this has been driving me nuts for most of the morning, and I can't seem to figure it out.  (But my code writing from scratch is scrappy, at the best of times!)

I have three shape layers that need to change size every second (or possibly at another set interval), but I have the sizes defined.  It's an animated chart, with each second marking a month, but for thea animation to go smoothly.

I have found a handful of expressions, but can't seem to get any of them to work as I need them.  I've tried this:

linear(time, 0, 1,  content("mycircle").size*1,  content("mycircle").size*1.3);

Which works for one second, but can't seem to get it to size for two seconds like this:

linear(time, 0, 1,  content("mycircle").size*1,  content("mycircle").size*1.3);

linear(time, 1, 2,  content("mycircle").size*1.3,  content("mycircle").size*1.4);

And I've tried this, which like the one above, only reads the last value in the script:

content("mycircle").size.valueAtTime(time + 1)*1;

content("mycircle").size.valueAtTime(time + 2)*1.3;

content("mycircle").size.valueAtTime(time + 3)*1.4;

I thought it might be possible to do with an array, somehow, but can't figure out how.

If "mycircle" size has to change every second for each month, as below:

MonthJanFebMarAprMayJunJulAugSepOctNovDec
Second123456789101112
Size11.31.41.31.61.21.21.111.41.51.2

What would be the best expression to do that?  Any help at all would be greatly appreciated!

I'm fairly new to expressions, too.  Please be gentle. 

TOPICS
Expressions
865
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 ,
Oct 03, 2011 Oct 03, 2011
LATEST

Try this:

myArray = [1,1.3,1.4,1.3,1.6,1.2,1.2,1.1,1,1.4,1.5,1.2];

idx = Math.min(Math.floor(time),11);

value*myArray[idx]

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