Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SCREEN 400,300
  2. 'Const sw=400
  3. 'Const sh=300
  4. sw=200
  5. sh=150
  6. SCREEN sw,sh,0,2
  7. Smooth2D ON
  8. kuva=LoadImage("media/map.bmp")
  9. ResizeImage kuva,sw,sh
  10. DrawImage kuva,0,0
  11. DrawScreen
  12. precalc= Timer()
  13. Dim offset(sw,sh,1) As Float
  14. Dim col(sw,sh,2)
  15. 'Lock' Image(kuva)
  16. For x=1 To sw-1
  17.     For y=1 To sh-1
  18.         ox=0
  19.         oy=0
  20.         For xx=-1 To 1
  21.             For yy=-1 To 1
  22.                 PickImageColor kuva,x+xx,y+yy
  23.                 If xx And yy Then
  24.                     c=((getRGB(RED)+getRGB(GREEN)+getRGB(BLUE)))/3
  25.                     'v=GetPixel(x+xx,y+yy)
  26.                    
  27.                     If xx=0 And yy=0 Then d=c
  28.                     d=Distance(0,0,xx,yy)
  29.                     ox=ox+c*xx/d
  30.                    
  31.                     oy=oy+c*yy/d
  32.                 Else
  33.                     col(x,y,0)=getRGB(RED)
  34.                     col(x,y,1)=getRGB(GREEN)
  35.                     col(x,y,2)=getRGB(BLUE)
  36.                 EndIf
  37.             Next yy
  38.         Next xx
  39.         'SetWindow ""+ox
  40.         'normalisoini tänne
  41.         offset(x,y,0)=ox'-d*3
  42.         offset(x,y,1)=oy'-d*3
  43.     Next y
  44.     SetWindow ""+(x/2)
  45. Next x
  46. 'Unlock
  47. precalc = Timer() - precalc
  48.  
  49. Repeat
  50.     t=Timer()/3
  51.     x1=sw/2+Sin(t/5)*sw/3
  52.     x2=sw/2+Sin(t/7)*sw/3
  53.     x3=sw/2+Sin(t/11)*sw/3
  54.     y1=sh/2+Sin(t/7)*sh/3
  55.     y2=sh/2+Sin(t/11)*sh/3
  56.     y3=sh/2+Sin(t/13)*sh/3
  57.     Lock
  58.    
  59.     For x=1 To sw-1
  60.         'a= Not a
  61.         For y=1+a To sh-2 'Step 2
  62.             'v3=ATan(20/Distance(x3,y3,x+offset(x,y,0),y+offset(x,y,1)))
  63.             'v2=ATan(20/Distance(x2,y2,x+offset(x,y,0),y+offset(x,y,1)))
  64.             'v=ATan(20/Distance(x1,y1,x+offset(x,y,0),y+offset(x,y,1)))
  65.             'PutPixel2 x,y,'v+v2 shl 8 +v3 shl 16'<>0)*255
  66.             'v#=ATan(20/Distance(x1,y1,x+offset(x,y,0),y+offset(x,y,1)))/90
  67.             'v3#=ATan(20/Distance(x3,y3,x+offset(x,y,0),y+offset(x,y,1)))/90
  68.             'v2#=ATan(20/Distance(x2,y2,x+offset(x,y,0),y+offset(x,y,1)))/90
  69.             v#=sin(ATan(10/Distance(x1,y1,x-offset(x,y,0),y-offset(x,y,1))))'/90
  70.             v3#=sin(ATan(10/Distance(x3,y3,x-offset(x,y,0),y-offset(x,y,1))))'/90
  71.             v2#=sin(ATan(10/Distance(x2,y2,x-offset(x,y,0),y-offset(x,y,1))))'/90
  72.             'v#=valo(int(x+offset(x,y,0)+256+sw+x1),Int(y+offset(x,y,1)+256+sh)+x2)
  73.             PutPixel2 x,y,Int(col(x,y,0)*v Shl 16+col(x,y,1)*v2 Shl 8+col(x,y,2)*v3)
  74.             'CopyBox int(x+offset(x,y,0)),Int(y+offset(x,y,1)),1,1,x-sw/2,y-sh/2,Image(kuva),SCREEN()
  75.         Next y
  76.     Next x
  77.     Unlock
  78.     SetWindow FPS()+" "+precalc
  79.     DrawScreen OFF
  80. Forever
  81. WaitKey
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement