Kinda simple looking...
Code: Select all
'Abstract Doodle 0057
'https://www.freebasic.net/forum/viewtopic.php?f=3&t=16207&start=7065
'======================= Colorizing Code ===================================
Dim as Single band, coff, dist
Dim as ULong colr, idx, pal(48)
band = 3.0 'MUST be greater than 0.0 to avoid division by zero error
coff = 6.0 'palette array 'Color Index Offset' (0 to 47)
For idx = 0 To 47
Read pal(idx)
Next
Data &H0000FF,&H2000FF,&H4000FF,&H6000FF,&H8000FF,&HA000FF,&HC000FF,&HE000FF
Data &HFF00FF,&HFF00E0,&HFF00C0,&HFF00A0,&HFF0080,&HFF0060,&HFF0040,&HFF0020
Data &HFF0000,&HFF2000,&HFF4000,&HFF6000,&HFF8000,&HFFA000,&HFFC000,&HFFE000
Data &HFFFF00,&HE0FF00,&HC0FF00,&HA0FF00,&H80FF00,&H60FF00,&H40FF00,&H20FF00
Data &H00FF00,&H00FF20,&H00FF40,&H00FF60,&H00FF80,&H00FFA0,&H00FFC0,&H00FFE0
Data &H00FFFF,&H00E0FF,&H00C0FF,&H00A0FF,&H0080FF,&H0060FF,&H0040FF,&H0020FF
'===========================================================================
dim as single c1,c2
dim as single s1,s2
dim as single x1,x2
dim as single y1,y2
dim as single deg1,deg2
dim as single rad1
dim as single rad2
dim as integer xctr, yctr, radius, divisions, fullcircle, toggle
dim as integer xres,yres
screeninfo xres,yres
screenres xres,yres,32
xctr = xres/2
yctr = yres/2 -10
'radius = (xres*yres)/((xres+yres)*4)
radius = 750
divisions = 45
rad1 = atn(1) / divisions
rad2 = atn(1) / (divisions/2)
fullcircle = 359 'atn(1)*8 / rad1
for deg1 = 0 to fullcircle * 8 step 45
c1 = cos( deg1 * rad1 )
s1 = sin( deg1 * rad1 )
x1 = radius * c1 / 40 * atan2( c1 , s1 * deg1 ) * 5
y1 = radius * s1 / 40 * atan2( s1 , c1 * deg1 ) * 5
for deg2 = 0 to fullcircle step .05
c2 = cos( deg2 * rad2 * 10 )
s2 = sin( deg2 * rad2 * 10 )
x2 = radius * (c2 eqv deg1) * c2 / 10000 * atan2( deg2 * c2 , deg1 * c1 ) / 4
y2 = radius * (s2 eqv deg1) * s2 / 10000 * atan2( deg2 * s2 , deg1 * s1 ) / 4
'Calc distance from current x1, y1 to the center of the screen
'then apply MOD of 48 to get a valid palette index value
dist = Sqr((xctr-x1)*(xctr-x1) + (yctr-y1)*(yctr-y1))
colr=pal((Int(dist/band) + coff) Mod 48)
pset( xctr +x1 +x2 , yctr +y1 +y2 ) , colr
pset( xctr -x1 -x2 , yctr +y1 +y2 ) , colr
pset( xctr +x1 +x2 , yctr -y1 -y2 ) , colr
pset( xctr -x1 -x2 , yctr -y1 -y2 ) , colr
next
next
Sleep
System
Code: Select all
'Abstract Doodle 0057
'https://www.freebasic.net/forum/viewtopic.php?f=3&t=16207&start=7065
'======================= Colorizing Code ===================================
Dim as Single band, coff, dist
Dim as ULong colr, idx, pal(48)
band = 3.0 'MUST be greater than 0.0 to avoid division by zero error
coff = 6.0 'palette array 'Color Index Offset' (0 to 47)
For idx = 0 To 47
Read pal(idx)
Next
Data &H0000FF,&H2000FF,&H4000FF,&H6000FF,&H8000FF,&HA000FF,&HC000FF,&HE000FF
Data &HFF00FF,&HFF00E0,&HFF00C0,&HFF00A0,&HFF0080,&HFF0060,&HFF0040,&HFF0020
Data &HFF0000,&HFF2000,&HFF4000,&HFF6000,&HFF8000,&HFFA000,&HFFC000,&HFFE000
Data &HFFFF00,&HE0FF00,&HC0FF00,&HA0FF00,&H80FF00,&H60FF00,&H40FF00,&H20FF00
Data &H00FF00,&H00FF20,&H00FF40,&H00FF60,&H00FF80,&H00FFA0,&H00FFC0,&H00FFE0
Data &H00FFFF,&H00E0FF,&H00C0FF,&H00A0FF,&H0080FF,&H0060FF,&H0040FF,&H0020FF
'===========================================================================
dim as single c1,c2
dim as single s1,s2
dim as single x1,x2
dim as single y1,y2
dim as single deg1,deg2
dim as single rad1
dim as single rad2
dim as integer xctr, yctr, radius, divisions, fullcircle, toggle
dim as integer xres,yres
screeninfo xres,yres
screenres xres,yres,32
xctr = xres/2
yctr = yres/2 -10
'radius = (xres*yres)/((xres+yres)*4)
radius = 750
divisions = 45
rad1 = atn(1) / divisions
rad2 = atn(1) / (divisions/2)
fullcircle = 359 'atn(1)*8 / rad1
for deg1 = 0 to fullcircle * 8 step 45
c1 = cos( deg1 * rad1 )
s1 = sin( deg1 * rad1 )
x1 = radius * c1 / 40 * atan2( c1 , s1 * deg1 ) * 5
y1 = radius * s1 / 40 * atan2( s1 , c1 * deg1 ) * 5
for deg2 = 0 to fullcircle step .05
c2 = cos( deg2 * rad2 * 10 )
s2 = sin( deg2 * rad2 * 10 )
x2 = radius * (c2 * deg1) * c2 / 10000 * atan2( deg2 * c2 , deg1 * c1 ) / 4
y2 = radius * (s2 * deg1) * s2 / 10000 * atan2( deg2 * s2 , deg1 * s1 ) / 4
'Calc distance from current x1, y1 to the center of the screen
'then apply MOD of 48 to get a valid palette index value
dist = Sqr((xctr-x1)*(xctr-x1) + (yctr-y1)*(yctr-y1))
colr=pal((Int(dist/band) + coff) Mod 48)
pset( xctr +x1 +x2 , yctr +y1 +y2 ) , colr
pset( xctr -x1 -x2 , yctr +y1 +y2 ) , colr
pset( xctr +x1 +x2 , yctr -y1 -y2 ) , colr
pset( xctr -x1 -x2 , yctr -y1 -y2 ) , colr
next
next
Sleep
System