seems we both got the same interests.

I want to talk with you.

Hope to hear from you.

mail: odoijoshua55@gmail.com

Facebook: Ataa Odoi

]]>thank you………!

]]>that is the formula of a line equation between two points: y = mx + b : http://www.coolmath.com/algebra/08-lines/12-finding-equation-two-points-01

Let’s see the case for the translateX value:

t -> maximum value to translate. If t is 20, then we want the element to be able to translate from -10 to 10.

self.dimensions.width -> the width of the main element (the screen’s width in this case).

ev.clientX -> mouse position (x-axis)

We want to translate the element as we move the mouse over the screen. For the translateX we will just take the mouse movement on the x-axis in consideration. If the mouse is on 0px then we want the element to translate -t/2, and if the mouse is on self.dimensions.width then the translation should be t/2. OK, so we have our two points:

P1(0,-t/2)

P2(self.dimensions.width,t/2)

And the equation:

y = (y2-y1)/(x2-x1) * ev.clientX + b < =>

y = (t/2 – (-t/2))/(self.dimensions.width – 0) * ev.clientX + b < =>

y = (2t/2)/self.dimensions.width * ev.clientX + (-t/2) < => // b = -t/2 (y-axis intersection)

y = t/self.dimensions.width * ev.clientX – t/2

Hope this makes sense.

Cheers.

movement – the parallax effect. Its the part with transX = t/(self.dimensions.width)*ev.clientX – t/2. Can’t wrap my head around it.

Cool.

]]>