Guest User

Untitled

a guest
Jul 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. // Update occupant style for desired effect
  2. occupants.forEach(function(occupant, index) {
  3. $(occupant).css({'right' : -10 * nudgeSine(occupantsMouseOffset[index] * 10) + 'px',
  4. 'top' : -10 * Math.abs(nudgeSine(occupantsMouseOffset[index] * 10)) + 'px',
  5. 'opacity' : 1 - Math.abs(nudgeSine(occupantsMouseOffset[index])) });
  6. });
  7.  
  8. // Function to return 1 period of a sine wave
  9. function nudgeSine(x) {
  10. if (x < -3.14159 || x > 3.14159) {
  11. return 0;
  12. } else {
  13. return Math.sin(x);
  14. }
  15. }
Add Comment
Please, Sign In to add comment