Coding Issue that involves Math!

martynball

New member
Joined
Dec 6, 2017
Messages
1
Hey, I'm coding something for a website, however, i'm stuck on a bit of Maths which is involved.

I will try my best to explain the issue. Let's say there are 3 layers, each of which occupies the same area, however, they move at different speeds depending on their "depth", so due to them being further away from the "camera" we need to adjust their size.

container height: 500.
window height: 860.

layer 1 depth: 1.0 (this is basically unchanged, so it's height should remain at 500).
layer 2 depth: 0.5
layer 3 depth: 0.1

So, let's say that 0.1 means that this layer needs to be 90% the size of the window height, however the calculation needs to account that 1.0 will simply be the size of the container...

If this doesn't make sense let me know and I will try and find a visual aid.
 
Hey, I'm coding something for a website, however, i'm stuck on a bit of Maths which is involved.

I will try my best to explain the issue. Let's say there are 3 layers, each of which occupies the same area, however, they move at different speeds depending on their "depth", so due to them being further away from the "camera" we need to adjust their size.

container height: 500.
window height: 860.

layer 1 depth: 1.0 (this is basically unchanged, so it's height should remain at 500).
layer 2 depth: 0.5
layer 3 depth: 0.1

So, let's say that 0.1 means that this layer needs to be 90% the size of the window height, however the calculation needs to account that 1.0 will simply be the size of the container...

If this doesn't make sense let me know and I will try and find a visual aid.
I, for one, am quite lost. What are you actually trying to accomplish?
 
Top