ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

What am i doing wrong? Trying to make a chasing expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Simon Hilton
What am i doing wrong? Trying to make a chasing expression
on Aug 15, 2018 at 8:38:48 pm

Im working on a project that has 2 dials. And I want to animate the first dial with key frames and use its values to run a cascade of other things...

The first thing its meant to do is cause dial 2 to chase dial 1s values. An ease in ease out effect.

Ive done this in software for UIs with simplistic ease. However each attempt of trying to duplicate the method in AEs expressions dont work.

It appears that the expression completely ignores the current or last frame value of the layer the expressions on.
Dial 1 is the RPM the main controller... Speed is dial 2
The expression is on the rotation option of the speed dial.
But the expression appears to completely ignore the speed value and just duplicate the rpm value. Ive wasted hours on this one today. Ive even tried putting the speed value into a slider for later reading (in at runtime) still didnt work even tried using thvalueattime subvalue, didnt work...

What am i doing wrong?

speed=this_comp.layer("Speed Dial").transform.rotation; //this I thought captures the current value
rpm=(120/100*(this_comp.layer("RPM Dial").transform.rotation)); // captures current rpm value

speed+(rpm-speed/10) //This should set the value to 10% closer to the target rpm, in UI runtime this would cause a smooth chasing effect of the changing rpm.


Return to posts index

Scott McGee
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 12:10:28 pm

Apologies as I don't quite understand what you are trying to do.

But I can tell you that

this_comp.layer should be written as thisComp.layer


Return to posts index

Simon Hilton
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 12:34:39 pm

Ahh thanks that was a typo when i posted... but sadly doesnt work

To really simplify the explanation... nullobject 1 is having its rotation value keyframed. I want to have nullobject 2 chase the values.

But im discovering that AE expressions cant see the value of the property the expression is running on.

Im having this same issue with another expression where im trying to find the current value thats being calculated for it. And add ontop of that current value.

Basically in the expression i posted here speed is getting NULL ie, not any value.


Return to posts index


Simon Hilton
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 12:48:23 pm

Another way to ask the question...

In expressions how do I do value=value+10 ?

An equation that takes the current expressed value and adds ontop of it?


Return to posts index

Scott McGee
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 3:33:19 pm

Unless I'm really not understanding it, it is simply.

thisComp.layer("Speed Dial").rotation + 10;

If it's suppose to do a percentage thing, then.

r = thisComp.layer("Speed Dial").rotation;

r + percentage of r


Return to posts index

Simon Hilton
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 3:39:12 pm

Yeah seems simple... but " thisComp.layer("Speed Dial").rotation " is referencing the layer this expression sits on. And for some reason refuses to see the actual value... Thats my problem


Return to posts index


Dan Ebberts
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 4:18:09 pm

Expressions have no access to results from previous frames. If an expression references the value of the property hosting the expression, it will always get the pre-expression value, as if the expression doesn't exist. There are work-arounds--some drastic, some not too bad.

Dan



Return to posts index

Scott McGee
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 4:18:08 pm

Have you got a screen grab, I'm not gonna lie I'm completely lost. It sounds very simple, but I'm missing something hahaha

So to clarify

Speed dial has the keyframes? or rpm dial?

Then which ever one has the keyframes, the other is to copy but +10?

If that's the case same expression I previously gave, but change speed dial to rpm dial.


Return to posts index

Simon Hilton
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 16, 2018 at 4:36:42 pm

I think Dan summed up the issue, expressions cant read the value of the expressed layer... in programming I would just have a global var to hold the value between cycles... Thats easy... Wish AE had some kind of global var storage. I know people have talked of storing in sliders but when i tried that I still got the same issue when it was trying to add to the current value.

I gave up anyway and hand animated it as I had to get the work done. Not perfect but it did the job of a concept design.


Return to posts index


Scott McGee
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 17, 2018 at 7:27:51 am

After reading Dan's response and your it makes more sense.

After effects is a lot more fiddly. I'll still never grasp coding entirely, but i've learnt most my stuff here from Dan or others. So if Dan's saying there are some ways around it. Might be worth delving a bit more for future reference. The more stuff is document the better I say.


Return to posts index

Kalleheikki Kannisto
Re: What am i doing wrong? Trying to make a chasing expression
on Aug 18, 2018 at 7:55:40 am

What I would do to get something similar to this would be a loop from 25 frames back to the current frame, taking the value of the speed meter at that time, then moving 10% toward the value of the speed meter at each frame until the current time. That way you get something that is very close to what you have in mind but it wouldn't have to go all the way back to the first frame of the comp. Visually the result would be very similar (93% the same with 25 frames).

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]