Advertisement
ShaunJS

Wave()

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