Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. --BRUSH Distortion: Waves v1.0
  2. --by Richard Fhager
  3. --http://hem.fyristorg.com/dawnbringer/
  4.  
  5. -- Copyright 2010 Richard Fhager
  6. --
  7. -- This program is free software; you can redistribute it and/or
  8. -- modify it under the terms of the GNU General Public License
  9. -- as published by the Free Software Foundation; version 2
  10. -- of the License. See <http://www.gnu.org/licenses/>
  11.  
  12. -- This script was adopted from Evalion, a Javascript codecrafting/imageprocessing project
  13. -- http://goto.glocalnet.net/richard_fhager/evalion/evalion.html
  14.  
  15.  
  16. --frq = 2
  17. --amp = 0.3
  18.  
  19. -- Adjust power of frequency & amplitude
  20. frq_adj = 2
  21. amp_adj = 0.02
  22.  
  23. ok,frq,amp = inputbox("Settings",
  24.                       "Frequency 1-10", 3, 1,10,0,
  25.                       "Amplitude 1-10", 3, 1,10,0
  26. );
  27.  
  28. w, h = getbrushsize()
  29.  
  30. for y = 0, h - 1, 1 do
  31.   for x = 0, w - 1, 1 do
  32.  
  33.     ox = x / w;
  34.     oy = y / h;
  35.     ox = (1 + ox + math.sin(oy*math.pi*frq*frq_adj)*amp*amp_adj) % 1;
  36.    
  37.     c = getbrushbackuppixel(math.floor(ox*w),y);
  38.     putbrushpixel(x, y, c);
  39.  
  40.   end
  41. end
  42.  
  43.