rerere284

direction

Apr 12th, 2016
260
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --made by rerere284
  2. function init()
  3.     setName("Direction")
  4.     setDesc("Direction from center")
  5.     setSize(100, 24+64+8+8+7+4)
  6.     addOutput(24+32)
  7.     addParameter("Offset", "Rotational offset", 24+64+8+8, 0, -1, -1)
  8. end
  9.  
  10. function apply()
  11.     tileSize = getTileSize()
  12.     math.randomseed(getValue(2, 0, 0, 1))
  13.     for i=0, tileSize*tileSize-1 do
  14.         x = (i%tileSize)
  15.         y = (math.floor(i/tileSize))
  16.         px = x - (tileSize/2)
  17.         py = y - (tileSize/2)
  18.         rot = math.atan2(py,px)/(math.pi*2) + (90/360) + (getValue(0, 0, 0, 1)/360)
  19.         setPixel(0, x, y, rot, rot, rot)
  20.     end
  21. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×