4 ms·
We implemented parallax for our signup form: http://42debut.com/#/demo/signup http://42debut.com/#/demo/signup The key is to feed the mouse position or device
by nickporter 13y ago
We implemented parallax for our signup form:
http://42debut.com/#/demo/signup http://42debut.com/#/demo/signup
The key is to feed the mouse position or device orientation into this easing function:
https://en.wikipedia.org/wiki/Error_function https://en.wikipedia.org/wiki/Error_function
Here's a nice JS approximation of that function:
http://picomath.org/javascript/erf.js.html http://picomath.org/javascript/erf.js.html
- alepper 13y agoI'm curious - it seems a little around-the-houses to have to use an approximation to erf when it's not obviously relevant. Why not just use an alternative sigmoid (e.g. the logistic function) or whatever the trigonometric solution falls out to be if you model it as a 'real' slewing or rotation motion around the scene?
- nickporter 13y agoInteresting! I honestly only used erf because that shape felt good to me. It looks like that logistic function is much simpler, and should give me pretty much the same result. But modelling it as a real scene sounds awesome, I'll experiment.
- 3rd3 13y agoWhy not 1/(1-|x|)?