FORUMS: list search recent posts

What am I doing wrong?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Will Bugden
What am I doing wrong?
on May 21, 2016 at 3:44:18 am

I've applied this expression

frames ++;
if (frames == 2) {
transform.position = [random()*5, random()*5];
frames = 0;
}

to position under transform and get this error

Error at line 1 in property 'Position' of layer 12

when I remove everything except

transform.position = [random()*5, random()*5];

the expression will show no errors

frames ++;
if (frames == 2) {
transform.position = [random()*5, random()*5];
frames = 0;
}


Return to posts index

Dan Ebberts
Re: What am I doing wrong?
on May 21, 2016 at 5:19:44 am

You haven't defined "frames". I'm not sure what you're trying to do, but it looks like maybe you're trying to set a random position and have it not change, which might look like this:

seedRandom(index,true);
random([5,5])

Dan



Return to posts index

Will Bugden
Re: What am I doing wrong?
on May 21, 2016 at 6:43:23 am

How do I define "frames"?


Return to posts index


Dan Ebberts
Re: What am I doing wrong?
on May 21, 2016 at 7:37:27 am

You can get the current frame with something like:

curFrame = timeToFrames(time);

What is it that you're trying to do?

I can't tell if you're aware of this (apologies if you are), but nothing that happens in an expression survives from one frame to the next. An expression has no way to reference past variable values or past results. You can re-calculate everything, but it won't just be waiting there.

Dan



Return to posts index

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