Copy link to clipboard
Copied
Hey looking to interpolate between random positions if someone could look this over id appreciate it.
i think i have the basic function, i have to create a second linear to but how could i reuse the last number?
function postErize(a){
if (a == 0){a = random(10)} //check for value
else {a = a}
posterizeTime(a) //posterize tmax
z = (time * 29.97) % 2 == 0 //time
x = random(1080);
y = random(1920);
linear(z, 0, a, x[0], x[0])
[value,value]
}
postErize(random(10))
Copy link to clipboard
Copied
I do not have the time to fiddle with your code but I see a lot of major problems. Your linear method is not defined or used anywhere. You need something like mOv = linear(t, tMin, tMax, value1, value2); and then you need to apply that to something.
The only array I see is [value, value] and that will return an error message, and even if it did work all it would do is return the current value of the property. You need something like [value[0] + something, value[1] + somethingElse] to make anything happen in the expression.
time * 29.97 sets the value of time at 1 second to 29.97 and the rest of the z part of your expression is meaningless.
You are also missing a lot of ending ; to separate instructions into anything meaningful.
What are you trying to do? I think you are trying to set up some random values at different times and have the layer move between them over several frames. If that is what you want the expression should start like this:
t = time - inPoint * thisComp.frameDuration; // counts frames
randOfst = 20; // The number of frames between random position values;
You could set up a random range for the randOfst or just leave it at 20 frames.
Then you need to generate random numbers between a specific set of values like zero and thisComp.width and increment those values every rndOfst number of frames. Then, and only then can you set up your linear function to move the X and Y values for the layer.
Dan Ebberts could probably write something that would do that in a couple of minutes. I would be messing with it for quite a while.
Copy link to clipboard
Copied
Let's begin with something very obvious: You cannot use "value" inside your own functions. It's a reserved keyword referencing the property value and will only cause errors or produce wrong results. Similarly, none of your checks will ever deliver any useful data if you are not running them inside a loop and also make sure the values are full integers and also have sensible ranges. The way you've written your stuff all your random() functions could return fractional or even negative values because the ranges are not constrained. And of course you need to interpolate the X and Y if you want to use this on position, not just one dimension. Your linear() makes no sense to me like pretty much the whole code. You really need to go back to the drawing board and educate yourself about some expression basics in AE. That and of course you will have to run it in a loop for multiple segments. Start by reading this:
http://www.motionscript.com/expressions-lab-ae65/random-motion.html
Mylenium