Advertisement
Guest User

Wave

a guest
Oct 21st, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///@description Wave(from, to, duration, offset);
  2. /// @function Wave
  3. /// @param from
  4. /// @param to
  5. /// @param duration
  6. /// @param offset
  7.  
  8. // Returns a value that will wave back and forth between [from ~ to] over [duration] seconds
  9. // Examples:
  10. //image_angle = Wave(-45, 0, 1, 0) -> rock back and forth 90 degrees in a second
  11. // x = Wave(-10, 10, 0.25, 0)       -> move left and right quickly
  12.  
  13. var a4 = (argument1 - argument0) * 0.5;
  14. return argument0 + a4 + sin((((current_time * 0.001) + argument2 * argument3) / argument2) * (pi * 2)) * a4;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement