nb109

wave()

Dec 22nd, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Wave(from, to, duration, offset)
  2.  
  3. /* Creator (and original version at): https://pastebin.com/u/ShaunJS */
  4.  
  5. // Returns a value that will wave back and forth between [from-to] over [duration] seconds
  6. // Examples
  7. //      image_angle = Wave(-45,45,1,0)  -> rock back and forth 90 degrees in a second
  8. //      x = Wave(-10,10,0.25,0)         -> move left and right quickly
  9.  
  10. // Or here is a fun one! Make an object be all squishy!! ^u^
  11. //      image_xscale = Wave(0.5, 2.0, 1.0, 0.0)
  12. //      image_yscale = Wave(2.0, 0.5, 1.0, 0.0)
  13.  
  14. a4 = (argument1 - argument0) * 0.5;
  15. return argument0 + a4 + sin((((current_time * 0.001) + argument2 * argument3) / argument2) * (pi*2)) * a4;
Add Comment
Please, Sign In to add comment