# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Posterize Linear interpolation

• # Posterize Linear interpolation

updated 7 months ago 2 Members · 3 Posts
• ### Tudor Baican

January 14, 2022 at 11:23 pm

Hello friends,

I would like to add some values to my position property.

position + A + B

Value A should be default linear.

Value B should be posterize linear by a custom frame rate.

If I use the posterize(myFrameRate) function, both values are posterized.

Maybe somebody here have an idea to realize this behavior.

Thanks

Tudor

• ### Andrei Popa

January 15, 2022 at 8:14 am

I don’t know of a posterize function, but you could use Math.floor().

Assuming that the lineart of your B uses time as first parameter, you could define B like this:

```myFrameRate = 3;
t = framesToTime(Math.floor(timeToFrames(time)/myFrameRate)*myFrameRate);
B = linear(t, 5, 6, 0, 100);```

First I turn time to frames, so I can work with myFrameRate. Then I divide it by the myFrameRate value to create the steps. Then I multimplicate it by the same value to not alter the actual value of time. Then I make it time again, via framesToTime(), so I can use it in the linear function.

If B is dependent on another value, not time, you could do something similar by using valueAtTime.

There may be some simpler solution, but I can’t think of one.

• ### Tudor Baican

January 15, 2022 at 3:19 pm

Hi Andrei,

I also came on a similar result after I post that. But I start first to turn the values in seconds.

I think your calculation hold a frame 3 frames long. Its not really a frame rate Frames/Sec.

I the end I think this is good and short result .

`fRate = 6;fps = 1/thisComp.frameDuration;fRateSec = framesToTime(fps/fRate, fps);pt = fRateSec*Math.floor(time/fRateSec);a = linear(pt, inPoint, outPoint, [0,0], [500,0]);b = linear(time, inPoint, outPoint, [0,0], [0,200]);position + a + b;`
Viewing 1 - 3 of 3 posts