ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Why won't the arrows move?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Michael Josefik
Why won't the arrows move?
on Aug 11, 2011 at 4:52:34 pm

So I am not sure if this is a post for here, or the expressions forum, but I will start here.

In the video below I want the arrows to move continuously throughout the clip. each line of arrows is an instance of a line of arrows in Illustrator and I used an expression in the "motion tile" effect to make it move over time. It shows up in the program when scrubbing through, but does not move in the render as you can see below.

Arrow motion error



I have included the project file (2780_arrowerrorprojfile.zip), but the expression I used is a couple variations of...

y=time*-220+70000;
[640,y]



Thanks in advance


Return to posts index

Dave LaRonde
Re: Why won't the arrows move?
on Aug 11, 2011 at 5:03:26 pm

Let's eliminate something very common right away. If something previews fine but doesn't render, it can be indicative of using Open GL to accelerate rendering. If you're using it, turn it off. It's okay for previewing, but about 95% of the time, it's NOT okay for rendering.

Dave LaRonde
Sr. Promotion Producer
KCRG-TV (ABC) Cedar Rapids, IA


Return to posts index

Michael Josefik
Re: Why won't the arrows move?
on Aug 11, 2011 at 5:12:51 pm

Well I learned something new in that I did not know that OpenGL rendering was not defaulted to "on" when sending to render queue. However, that means that it wasn't checked for the render I did.


Return to posts index


Darby Edelen
Re: Why won't the arrows move?
on Aug 11, 2011 at 6:25:17 pm

[Michael Josefik] "Well I learned something new in that I did not know that OpenGL rendering was not defaulted to "on" when sending to render queue. However, that means that it wasn't checked for the render I did."

You don't ever want to use OpenGL for a final render. OpenGL rendering uses a smaller feature set than the standard renderer and makes concessions that can result in degraded footage.

Now, to the problem at hand. Is there any reason to be adding or subtracting 50000-70000 pixels in your expression? I don't see a reason to.

Here's my adjusted expression:

s = effect("Speed")("Slider");
y=(time * s) % thisComp.height;
[640,y]


I've also added an Effect > Expression Controls > Slider Control named "Speed" to the layer. You can see that the variable 's' is assigned the value of this slider in the first declaration. This allows you to change the speed at which the arrows travel without having to adjust the expression itself. You could even animate the Speed slider to change the speed of the arrows over time.

The second change is removing the 50000-70000 pixel offset you included (this probably failed because it's out of the range of what the effect can handle). Since the motion is cyclic, there's no reason to offset by that much. If you think of them as tiles, the offset you had would start the cycling at vertical tile #700 instead of #0.

I added "% thisComp.height" to the end of that declaration. This effectively cycles 1 tile, so no matter how long your composition is you can never get to tile 700 (no breaking this motion tile!). This works because every tile is exactly the same. The analogy I would use is that the revised expression is like looping one song in a playlist instead of duplicating that song as many times as you need it and playing through all of the duplicates.

Darby Edelen


Return to posts index

Michael Josefik
Re: Why won't the arrows move?
on Aug 11, 2011 at 7:23:14 pm

Thanks! That helped tremendously. Interesting that it doubled the render time, but it works. And that is what matters.

If it isn't too much trouble, could you explain how the "% thisComp.height" makes it only repeat one tile? I am not very good with expressions yet and that is the only part of the expression I did not understand. I am trying to wrap my head around it, but it is not happening.


Return to posts index

Darby Edelen
Re: Why won't the arrows move?
on Aug 11, 2011 at 7:36:50 pm

[Michael Josefik] "If it isn't too much trouble, could you explain how the "% thisComp.height" makes it only repeat one tile? I am not very good with expressions yet and that is the only part of the expression I did not understand. I am trying to wrap my head around it, but it is not happening."

The modulo operator (%) returns the remainder of a division operation.

So:

1 % 2 = 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
5 % 2 = 1

or:

1 % 3 = 1
2 % 3 = 2
3 % 3 = 0
4 % 3 = 1
5 % 3 = 2
6 % 3 = 0

So you can see that what this does as the first value increases is cycles between 0 and n - 1 where n is the second number.

It returns 0 when n is evenly divisible into the first number. So, for example, x % 2 will always return 0 for even numbers and 1 for odd numbers.

Darby Edelen


Return to posts index


Michael Josefik
Re: Why won't the arrows move?
on Aug 11, 2011 at 9:38:58 pm

Ok, there is a possibility that my brain is just not ready for this sort of math/scripting, but I will try to explain where I am having trouble and maybe you can help or point me to a link that may help.

So if I am understanding this correctly...

the remainder of (time * s)/thisComp.height=y (where it will appear on the y-axis)

So if it was (300*100)/720 then the answer would be 41.666 and the position on the y-axis would be whatever .666 converts to as a remainder.

Is that correct?


Return to posts index

Darby Edelen
Re: Why won't the arrows move?
on Aug 11, 2011 at 10:10:02 pm

[Michael Josefik] "So if it was (300*100)/720 then the answer would be 41.666 and the position on the y-axis would be whatever .666 converts to as a remainder.

Is that correct?"


Yes, and to calculate the remainder you can multiply the decimal portion by 720.

When the result of the division is a whole number, the decimal portion (the remainder) is 0 and so the result of the modulo is 0.

A deep understanding of the modulo operator probably isn't necessary. Just remember that for x % n as x increases the output will range from 0 to n-1 and cycle.

Darby Edelen


Return to posts index

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