twofingers
 Guru
 Joined: 02/06/2014 Location: GermanyPosts: 1752 |
| Posted: 01:25pm 02 Dec 2024 |
|
|
|
I think this is a nice example to understand "map" and to play with it.
'Toroidal Reactor by javavi/2024 MODE 2 Map Reset
Dim PicFile$="iter.bmp" Dim integer cm(15)=(15,7,1,0,0,10,10,10,10,10,10,10,10,10,10,10)'red iter 'Dim integer cm(15)=(0,15,7,1,0,0,0,0,0,0,0,0,0,0,0,0)'dark iter 'Dim integer cm(15)=(15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)'colorful iter Colour Map cm(),cm()
If MM.Info(exists file PicFile$) Then Load image PicFile$ Else For U=0 To 159 x1=U/128-1.25 For V=0 To 239 y1=V/128-1 X=0:Y=X:Z=-2.4 Do k1=Sqr(X*X+Z*Z)-2 d1=1-Sqr(k1*k1+Y*Y) X=X+x1*d1:Y=Y+y1*d1:Z=Z+d1 Loop Until d1<.005 v1=Atn(Z/X):u1=Atn(Y/k1)
sColor(): Pixel U,V v1=3.13-v1 sColor(): Pixel 319-U,V Next Next Save image PicFile$ EndIf
Do T=cm(1) For i=1 To 15-1:cm(i)=cm(i+1):Next cm(15)=T For i=1 To 15:Map(i)=cm(i):Next Map Set Pause 50 Loop
Sub sColor() p=Sin(Int((u1+v1)*40)*99)*98 c=15 And ((u1-v1+p)*24*Abs(Sin(p))) Color Map(c) End Sub
/* 15 WHITE RGB(255, 255, 255) 14 YELLOW RGB(255, 255, 0) 13 LILAC RGB(255, 128, 255) 12 BROWN RGB(255, 128, 0) 11 FUCHSIA RGB(255, 64, 255) 10 RUST RGB(255, 64, 0) 9 MAGENTA RGB(255, 0, 255) 8 RED RGB(255, 0, 0) 7 CYAN RGB(0, 255, 255) 6 GREEN RGB(0, 255, 0) 5 CERULEAN RGB(0, 128, 255) 4 MIDGREEN RGB(0, 128, 0) 3 COBALT RGB(0, 64, 255) 2 MYRTLE RGB(0, 64, 0) 1 BLUE RGB(0, 0, 255) 0 BLACK RGB(0, 0, 0) */ > |