Squares

General FreeBASIC programming questions.
Locked
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Post by dodicat »

Thanks Albert.
It's time I made up another doodle myself, it's been a while, I've got withdrawal syndrome coming on.
I'm going to post my glclock in tips 'n tricks, but I've now printed the day on the screen, and I must wait until midnight, or I should say, one second after midnight to see if it works.
But never mind, Jaws 2 is coming on in a minute or two on the gogglebox.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Dodicat

A month or so ago , the cable company on one of the channels showed all the "Jaws" movies back to back.

They also showed all the "Aliens" movies back to back..
Those are my favorite sy-fi movies. I like the "Predator vs. Aliens" one best, with all the moving and changing floors and walls.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Abstract

Post by albert »

Heres another one Abstract-541.BAS

Code: Select all


dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres
'===============================================================================
'===============================================================================
dim as double deg1,c1,s1,x1,y1
dim as double deg2,c2,s2,x2,y2
dim as double radius=125
dim as double rad=atn(1)/45
dim as double xctr=xres/2
dim as double yctr=yres/2

for deg1 = 0 to 360 step 1
    
    c1 = Cos(deg1*rad)
    s1 = Sin(deg1*rad)
    
    for deg2=0 to 360 step 2
    
        c2= Cos(deg2*rad)
        s2= Sin(deg2*rad)
    
        x1=radius*c1*c2*c2*s2*2
        x2=radius*s1*s2*atan2(tan(c1*deg2*rad),c2*s2)
        y1=radius*c1*c2*atan2(tan(c1*deg2*rad),c2*s2)
        y2=radius*s2*s2*s2*c2*2
        
        pset(xctr+x1+x2,yctr+y1+y2), 9
    
    next
    sleep 10
next

sleep
END

Abstract-542.BAS

Code: Select all


dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres
'===============================================================================
'===============================================================================
dim as double deg1,c1,s1,x1,y1
dim as double deg2,c2,s2,x2,y2
dim as double radius=100
dim as double rad=atn(1)/45
dim as double xctr=xres/2
dim as double yctr=yres/2

for deg1 = 0 to 360 step 1
    
    c1 = Cos(deg1*rad)
    s1 = Sin(deg1*rad)
    
    for deg2=0 to 360 step 2
    
        c2= Cos(deg2*rad)
        s2= Sin(deg2*rad)
    
        x1=radius*c1*c2*c2*s2*(c2*5)
        x2=radius*s1*s2*atan2(tan(c1*deg2*rad),atn(c2*s2*s2*deg2*rad))
        y1=radius*c1*c2*atan2(tan(c1*deg2*rad),atn(c2*s2*s2*deg2*rad))
        y2=radius*s2*s2*s2*c2*(s2*5)
        
        pset(xctr+x1+x2,yctr+y1+y2), 9
    
    next
    sleep 10
next

sleep
END

Abstract-543.BAS

Code: Select all


dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres
'===============================================================================
'===============================================================================
dim as double deg1,c1,s1,x1,y1
dim as double deg2,c2,s2,x2,y2
dim as double radius=100
dim as double rad=atn(1)/45
dim as double xctr=xres/2
dim as double yctr=yres/2

for deg1 = 0 to 360 step 1
    
    c1 = Cos(deg1*rad)
    s1 = Sin(deg1*rad)
    
    for deg2=0 to 360 step 2
    
        c2= Cos(deg2*rad)
        s2= Sin(deg2*rad)
    
        x1=radius*c1*c2*c2*s2*atan2(cos((c2*5)*c2*deg2*rad),tan(s1+s2)) 
        x2=radius*s1*s2*atan2(tan(c1*deg2*rad),atn(c2*s2*s2*deg2*rad))
        y1=radius*c1*c2*atan2(tan(c1*deg2*rad),atn(c2*s2*s2*deg2*rad))
        y2=radius*s2*s2*s2*c2*atan2(cos((s2*5)*c2*deg2*rad),tan(s1+s2))
        
        pset(xctr+x1+x2,yctr+y1+y2), 9
    
    next
    sleep 10
next

sleep
END

The possible outputs for just a double degree loop , I think is endless..
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Abstracts

Post by albert »

Abstract-545.BAS

Code: Select all


dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres
'===============================================================================
'===============================================================================
dim as double rad1=atn(1)/45
dim as double deg1
dim as double deg1_start =  0
dim as double deg1_end   =360+45
dim as double deg1_inc   =  .5


dim as double rad2=atn(1)/45
dim as double deg2
dim as double deg2_start=  0
dim as double deg2_end  =360
dim as double deg2_inc  =  1

dim as double c1
dim as double c2

dim as double s1
dim as double s2

dim as double x1
dim as double y1

dim as double x2
dim as double y2

dim as double radius=100
dim as double xctr=xres/2
dim as double yctr=yres/2

for deg1 = deg1_start to deg1_end step deg1_inc
    
    c1 = Cos(deg1*rad1)
    s1 = Sin(deg1*rad1)
    
    for deg2 = deg2_start to deg2_end step deg2_inc
        
        c2= Cos(deg2*rad2)
        s2= Sin(deg2*rad2)
    
        x1=radius*c1*atan2(c1,s2)*atan2(c1,s2)/2*c2*atn(deg1*rad1*c1)*cos(c1*s1*10)*2
        y1=radius*s1*atan2(c1,s2)*atan2(c1,s2)/4*s1*atn(deg1*rad1*s1)*sin(s1*c1*10)
        
        x2=radius*c2*atan2(c2,s1)*atan2(c2,s1)/2*s1*s1*c1*cos(c1*deg1*rad1)*cos(c2*s2*10)*2
        y2=radius*s2*atan2(c2,s1)*atan2(c2,s1)/4*c1*c1*s1*sin(s1*deg1*rad1)*sin(s1*c1*10)
        
        pset(xctr+x1+x2,yctr+y1+y2), 9
    
    next
    sleep 10
next

sleep
END

Abstract-546.BAS

Code: Select all

dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres
'===============================================================================
'===============================================================================
dim as double rad1=atn(1)/45
dim as double deg1
dim as double deg1_start =  0
dim as double deg1_end   =360
dim as double deg1_inc   =  1


dim as double rad2=atn(1)/45
dim as double deg2
dim as double deg2_start=  0
dim as double deg2_end  =360
dim as double deg2_inc  =  1

dim as double c1
dim as double c2
dim as double s1
dim as double s2

dim as double x1
dim as double y1
dim as double x2
dim as double y2

dim as double radius=150
dim as double xctr=xres/2
dim as double yctr=yres/2

for deg1 = 0 to 360 step 1
    
    c1=cos(deg1*rad1)
    s1=sin(deg1*rad1)
    
    for deg2 = 0 to 360 step 1
        
        c2 = cos(deg2*rad2)
        s2 = sin(deg2*rad2)
        
        x1=radius*c1/log(deg2*rad2*c2)/c1*c2*log(deg2*rad2*c2*c2*c2*c2)*c1*c1/2
        x2=radius*c2*cos(deg2*rad2*c1)*tan(deg2*rad2*c2-c2-s2*5*c2*c2-s2)*atan2(c2+s2,atn(c2+s2))
        
        y1=radius*s1*cos(deg2*rad2*c1)*tan(deg2*rad2*c2-c2-s2*5*c2*c2-s2)*atan2(c2+s2,atn(c2+s2))
        y2=radius*s2/log(deg2*rad2*c2)/c1*c2*log(deg2*rad2*c2*c2*c2*c2)*s1*s1/2
        
        pset( xctr+y1+y2 , yctr+x1+x2 ) , deg2  
                 'x1,x2 and y1,y2 are reversed
        
    next
    sleep 10
next

sleep

albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

I've been reading the tutorial

"Lets Build A Compiler"

I'm working on my own BASIC now, sort of.

I figure if i'm gonna do an OS, i need pure uncompressed binaries as compiler output, so i got FASM too.
I'm going to define my own filesystem type (just a plain text file at the top of the drive.) with names and pointers to file location.

I think I'll have to convert the Linux Kernel, mostly the hardware interaction part of it.

I got 7-ZIP and clicked on some FB created exe's and it opens to show the contents of the cabinet.
Is the .text section encrypted and compressed or just compressed ???
dafhi
Posts: 1641
Joined: Jun 04, 2005 9:51

Re: Squares

Post by dafhi »

OS creation is on my ToDo list :-)
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

After running Linux (Red-Hat 5.0 , 5.1 , 6.0 , Suse 6.1 , TopologiLinux 7.?.? , PCLinuxOS 12.0 UBUNTU ?-64)
And DOS and Windows DOS 4.0 , DOS 5.0 , DOS 6.0 , Windows 3.1 , Windows 95 , Winodows 98 , Windows 2000NT , Vista and now Windows 7-64.

I've come to the conclusion that the Kernel should only:
Load/unload programs into/outof memory.
Handle memory defragmentation
setup and manage a thread pool
Act as a go-between, between programs and hardware.
(but all hardware control should be done by generic or commercial loadable/unloadable drivers.)

Its the hardware drivers that make Linux difficult , if you call a mfg. and ask them how to setup their hardware and put it in its different modes and how to write/read, to/from it , they won't tell you.
dafhi
Posts: 1641
Joined: Jun 04, 2005 9:51

Re: Squares

Post by dafhi »

Odd state of affairs of the software / hardware industry. Seems like if you buy a product, you should be able to use it. That's not the case when manufacturers won't give out foundational specifications.

As much as I've ranted about seemingly inefficient modes of commercial products (file fragmentation), I must admit, a company who can build a successful fragmenting FS (by successful I mean the OS can function) is more skilled than one who cannot.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

I've thought about that.

The old DOS 5 came with COPY and XCOPY as well as ScanDisk.
If you used COPY to a floppy and then ScanDisked it , you could see the fragmentation (the file would show up in lots of plasces)
With XCOPY there was no file fragmentation except across BadBlocks.

I think fragmentation shouldn't happen except in the "BadBlock" instance.

But I'm still working on the language outline and compiler,
I'm thinking of putting each KeyWord in its own sourcecode file; where the compiler pulls in the source and compiles it along with the program code.
Then If I get a forum for the language , anyone could optimize the KeyWord sources and everyone could benefit.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Abstract 547

Post by albert »

Abstract-547.bas

Code: Select all

dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres

dim as double c1,c2,s1,s2
dim as double x1,x2,y1,y2
dim as double rad=atn(1)/45
dim as double xctr,yctr,radius=150
dim as double deg1,deg2,span

xctr=xres/2
yctr=yres/2

for deg1 = 0 to 360 step 1
    
    c1=cos(deg1*rad)
    s1=sin(deg1*rad)
    
    for deg2 = 0 to 360 step .5
        
        c2 = cos(deg2*rad)
        s2 = sin(deg2*rad)
        
        x1=radius*c1*c1*s1*tan((s2/s1)/(c1/s1)/c1)*cos(c2*s2*s1)/2
        x2=radius*c2/c1/2
        
        y1=radius*s1*c1*s1*tan((c2*s2)/(c1*s1)/c1)*cos(c2*s2*s1)/2
        y2=radius*s2/c1/2
        
        pset(xctr+x1+x2,yctr+y1+y2),9
        
    next
next

sleep

albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

abstract548

Post by albert »

Abstract548.bas

Code: Select all

dim as integer xres,yres
screen 19
screeninfo xres,yres
screenres xres,yres

dim as double c1,c2,s1,s2
dim as double x1,x2,y1,y2
dim as double rad=atn(1)/45
dim as double xctr,yctr,radius=150
dim as double deg1,deg2,span

xctr=xres/2
yctr=yres/2

for deg1 = 0 to 360 step 1
    
    c1=cos(deg1*rad)
    s1=sin(deg1*rad)
    
    for deg2 = 0 to 360 step 1
        
        c2 = cos(deg2*rad)
        s2 = sin(deg2*rad)
        
        x1=radius*c1*c1*s1*c2*cos(s2)*5
        x2=radius*c2/c1*tan(s2*c2)*sin(c2)*sin(s2)
        
        y1=radius*s1*c1*s1*s2*cos(s2)*5
        y2=radius*s2/c1*tan(s2*c2)*sin(c2)*sin(s2)
        
        pset(xctr+x1+x2,yctr+y1+y2),9
        
    next
    
    sleep 10
    
next

sleep

I think its just endless; the kinds of patterns that are possible..
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Whirly-gig

Post by albert »

I played around with the Hypno-Spiral from a few pages ago.

Code: Select all

#Include Once "GL/glu.bi"
Dim As Integer xres,yres
Screeninfo xres,yres
screenres xres,yres , 32,,10

glOrtho ( 0 , xres , 0 , yres, -1, 1)
'===============================================================================
'===============================================================================
dim times  as INTEGER : times = 100
DIM num    AS INTEGER : num = 360 * times
DIM radius AS SINGLE  : radius = yres / 2.25
DIM xctr   AS SINGLE  : xctr=xres/2
DIM yctr   AS SINGLE  : yctr=yres/2
DIM deg1   AS SINGLE  : deg1=0
DIM rad    AS SINGLE  : rad=atn(1)/45
DIM n      AS INTEGER
DIM x_toggle AS INTEGER : x_toggle=0
DIM y_toggle AS INTEGER : y_toggle=0
'===============================================================================
'===============================================================================
TYPE xy
    x AS SINGLE
    y AS SINGLE
END TYPE

Dim  points(num) as xy
'===============================================================================
'===============================================================================
FOR n = 1 TO num
    points(n).x=xctr + ( radius * cos(n*rad*-(.02/rad)) )
    points(n).y=yctr + ( radius * sin(n*rad*-(.02/rad)) )
    IF (n MOD 360) = 0 THEN radius-= radius / ((360-(n/times))/3.75) '(times/2.5))
NEXT n
'===============================================================================
'===============================================================================
Do
    glClear (GL_COLOR_BUFFER_BIT)
    glBegin (GL_POINTS)
    deg1=0
    For n = 1 To num
        
        IF n < num THEN
            points(n).x = points(n + 1).x
            points(n).y = points(n + 1).y
        ELSE
            points(num).x = points(1).x
            points(num).y = points(1).y
        END IF
        
        glColor3f( tan(deg1*rad*5) , tan(deg1*rad*4) , tan(deg1*rad*2) )
        glVertex2f( points(n).x , points(n).y )
        
        deg1+=1
        if deg1=361 then deg1=0
        
    Next n
    glend
    Flip
    
    'speed it up by rotating several times thru array
    for inc as integer = 1 to 1
    for n = 1 to num
        IF n < num THEN
            points(n).x = points(n + 1).x
            points(n).y = points(n + 1).y
        ELSE
            points(num).x = points(1).x
            points(num).y = points(1).y
        END IF
        
    next n
    next inc
    
    for n = 1 to num
        'add some special effects
        points(n).x+=atn(cos(n^1.05*rad*7))*7
        points(n).y+=atn(sin(n^1.05*rad*7))*7
        
        if points(1).x <=   1 then x_toggle = 1
        if points(1).x >=xres then x_toggle = 0
        
        if points(1).y <=   1 then y_toggle = 1
        if points(1).y >=yres then y_toggle = 0
        
        if x_toggle=0 then points(n).x-=5
        if x_toggle=1 then points(n).x+=5
        
        if y_toggle=0 then points(n).y-=5
        if y_toggle=1 then points(n).y+=5
    
    next n
    
        
Loop Until Inkey<>""

dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Post by dodicat »

Hi Albert
I've been messing around with a new 3D rotator/scaler/perspective setter.
The whole thing in about 20 lines, I've given it a test run on your spiral.

Code: Select all

 #Include Once "GL/glu.bi"
Dim As Integer xres,yres,glscreen=2,fullscreen=1
#define plus or 
Screeninfo xres,yres
screenres xres,yres , 32,,glscreen plus fullscreen

glOrtho ( 0 , xres , 0 , yres, -1, 1)
'===============================================================================
'===============================================================================
dim times  as INTEGER : times = 100
DIM num    AS INTEGER : num = 360 * times
DIM radius AS SINGLE  : radius = yres / 2.25
DIM xctr   AS SINGLE  : xctr=xres/2
DIM yctr   AS SINGLE  : yctr=yres/2
DIM deg1   AS SINGLE  : deg1=0
DIM rad    AS SINGLE  : rad=atn(1)/45
DIM n      AS INTEGER
DIM x_toggle AS INTEGER : x_toggle=0
DIM y_toggle AS INTEGER : y_toggle=0
'===============================================================================
'===============================================================================
TYPE v3
    x AS SINGLE
    y AS SINGLE
    z as single
    col as uinteger 'not used here
END TYPE

Dim  points(num) as v3
'===============================================================================
'===============================================================================
FOR n = 1 TO num
    points(n).x=xctr + ( radius * cos(n*rad*-(.02/rad)) )
    points(n).y=yctr + ( radius * sin(n*rad*-(.02/rad)) )
    points(n).z=360*n/num
    IF (n MOD 360) = 0 THEN radius-= radius / ((360-(n/times))/3.75) '(times/2.5))
NEXT n
'===============================================================================
'===============================================================================
'''3D rotator
'===============================================================================
function rotate3d(byval pivot as v3,byval pt as v3,byval Angle as v3, byval scale as v3=type<v3>(1,1,1)) as v3
        #define cr 0.0174532925199433
       Angle=type<v3>(Angle.x*cr,Angle.y*cr,Angle.z*cr)
        #macro Rotate(a1,a2,b1,b2,d)
        temp=type<v3>((a1)*cos(Angle.d)+(a2)*sin(Angle.d),(b1)*cos(Angle.d)+(b2)*sin(Angle.d))
        #endmacro
        dim as v3 p=type<v3>(pt.x-pivot.x,pt.y-pivot.y,pt.z-pivot.z)
        dim as v3 rot,temp
        Rotate(p.y,-p.z,p.z,p.y,x)'X
        rot.y=temp.x:rot.z=temp.y 
        p.y = rot.y:p.z = rot.z 
        Rotate(p.z,-p.x,p.x,p.z,y)'Y
        rot.z=temp.x:rot.x=temp.y
        p.x=rot.x
        Rotate(p.x,-p.y,p.y,p.x,z)'Z
        rot.x=temp.x:rot.y=temp.y
        return type<v3>((scale.x*rot.x+pivot.x),(scale.y*rot.y+pivot.y),(scale.z*rot.z+pivot.z),pt.col)
end function
'perspective function(optional)
Function apply_perspective(byval p As v3,byval eyepoint as v3) As v3
            Dim As Single   w=1-(p.z/eyepoint.z)
            Return type((p.x-eyepoint.x)/w+eyepoint.x,(p.y-eyepoint.y)/w+eyepoint.y,(p.z-eyepoint.z)/w+eyepoint.z,p.col)
        End Function
        ''End Rotator
  '=============================================================================      
  dim as v3 pivot=type(xres/2,yres/2,0) ,angle,scaler=type(.5,.5,.5),eyepoint=type(xres/2,yres/2,400) 
  dim as v3 temp(ubound(points))
  'rotates round pivot
  'angle as v3 i.e. x,y and z rotations available
  'eyepoint for perspective
  'scaler to scale on x or y or z axis
Do
    glClear (GL_COLOR_BUFFER_BIT)
    glBegin (GL_POINTS)
    deg1=0
    For n = 1 To num
        
        IF n < num THEN
            points(n).x = points(n + 1).x
            points(n).y = points(n + 1).y
        ELSE
            points(num).x = points(1).x
            points(num).y = points(1).y
        END IF
        
        glColor3f( tan(deg1*rad*5) , tan(deg1*rad*4) , tan(deg1*rad*2) )
        '==========  glvertex temp(n), i.e. the rotated points ================
        glVertex2f( temp(n).x , temp(n).y )
        
        deg1+=1
        if deg1=361 then deg1=0
        
    Next n
    glend
    Flip
    
    '===============  rotator angles ==========================================
    angle.y=angle.y+1:angle.x=angle.x+1.5:angle.z=angle.z+.5
    if angle.x>=360 then angle.x=0
    if angle.y>=360 then angle.y=0
    if angle.z>=360 then angle.z=0
    '==========================================================================
    
    'speed it up by rotating several times thru array
    for inc as integer = 1 to 1
    for n = 1 to num
        
        
        '======================================================================
        'rotate and apply perspective (NEW)
        temp(n)=rotate3d(pivot,points(n),angle,scaler)
        temp(n)=apply_perspective(temp(n),eyepoint)
        '======================================================================
        
        
        IF n < num THEN
            points(n).x = points(n + 1).x
            points(n).y = points(n + 1).y
        ELSE
            points(num).x = points(1).x
            points(num).y = points(1).y
        END IF
        
    next n
    next inc
    
    for n = 1 to num
        'add some special effects
        points(n).x+=atn(cos(n^1.05*rad*7))*7
        points(n).y+=atn(sin(n^1.05*rad*7))*7
        
        if points(1).x <=   1 then x_toggle = 1
        if points(1).x >=xres then x_toggle = 0
        
        if points(1).y <=   1 then y_toggle = 1
        if points(1).y >=yres then y_toggle = 0
        
        if x_toggle=0 then points(n).x-=5
        if x_toggle=1 then points(n).x+=5
        
        if y_toggle=0 then points(n).y-=5
        if y_toggle=1 then points(n).y+=5
    
    next n
    
        
Loop Until Inkey<>""

 
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Dodicat
It works great!!
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Angel

Post by albert »

My internet has been down for some time now, it just came back up this morning.

I animated some of my Abstract-??.bas files.

Angel

Code: Select all


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 span
dim as single rad1
dim as single rad2


dim as integer xctr, yctr, radius, divisions, fullcircle, toggle

dim as integer xres,yres
'screen 19
screeninfo xres,yres
screenres xres,yres,8,1,8

xctr = xres/2
yctr = yres/2

radius = (xres*yres) / ((xres+yres)*3)
divisions = 45

rad1 = atn(1) / divisions
fullcircle = atn(1)*8 / rad1
span = 0

toggle = 0
do
    
        screenset 1,0
        screenlock
        
        for deg1 = 0 to fullcircle step 1
    
            c1=cos(deg1*rad1+log(span^2))
            s1=sin(deg1*rad1+log(span^2))
        
            x1=radius*c1*log(c1*c1*span)
            y1=radius*s1*log(s1*s1*span)*s1
            
        for deg2 = 0 to fullcircle step 1
            
            c2=cos(deg2*rad1)
            s2=sin(deg2*rad1)
            
            x2=radius*c2*c2*c1*cos(tan(deg2*rad1*c1*c1))*atan2((c2+s1+s2)*s2 , s1+s2/c2*s2)*.55
            y2=radius*s2*s2*s1*sin(tan(deg2*rad1*s1*s1))*atan2((c2+s1+s2)*s2 , s1+s2/c2*s2)*.25
 
            ' pset(xctr+x1+x2,yctr+y1+y2),9
            pset(xctr+x1+x2,yctr+y1+y2),deg2 ' cool rainbow color
            
        next
    
        next
    
    screencopy 0,1
    screenset 0,0
    screensync
    screenunlock
    sleep 1
    
    'scroll back and forth thru som values to animate
    select case toggle
        case 0
            span += rad1*4.5
            if span >=  +(fullcircle/50) then toggle = 1
            cls
        case 1
            span -= rad1*4.5
            if span <=  -0               then toggle = 0
            cls
    end select
    
loop until inkey <>""

From Galactic-Chicken

Code: Select all

' From galactic-chicken.bas

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 span
dim as single rad1
dim as single rad2


dim as integer xctr, yctr, radius, divisions, fullcircle, toggle

dim as integer xres,yres
'screen 19
screeninfo xres,yres
screenres xres,yres,8,1,8

xctr = xres/2
yctr = yres/2

radius = (xres*yres)/((xres+yres)*4)

divisions = 45

rad1 = atn(1) / divisions
rad2 = atn(1) / (divisions/2)
fullcircle = atn(1)*8 / rad1
span = rad1*2

toggle = 0
do
    
        screenset 1,0
        screenlock
        
        for deg1 = 0 to fullcircle step 1
    
            c1=cos(deg1*rad1+(span))
            s1=sin(deg1*rad1+(span))
    
            x1=radius*c1
            y1=radius*s1
    
        for deg2 = 0 to fullcircle step 1
            
            c2=cos(deg2*rad2+cos(span))
            s2=sin(deg2*rad2+sin(span))
        
            x2=radius*s2*(log(deg2*rad1*s2+log(span*4)))*atn(deg2*rad2*s2/s1)*atn(deg2*rad2*c1*s1*c2*span)*sin(deg2/(s1*c1*s1*c1)*rad1*rad1+span)
            y2=radius*c2*(log(deg2*rad1*c2+log(span*4)))*atn(deg2*rad2*c2/c1)*atn(deg2*rad2*c1*s1*c2*span)*sin(deg2/(s1*c1*s1*c1)*rad1*rad1+span)
             
            ' pset(xctr+x1+x2,yctr+y1+y2),9
            pset(xctr+x1+x2,yctr+y1+y2),deg2 ' cool rainbow color
            
        next
    
    next
    
    screencopy 0,1
    screenset 0,0
    screensync
    screenunlock
    sleep 1
    
    'scroll back and forth thru som values to animate
    select case toggle
        case 0
            span += rad1*3
            if span >=  +fullcircle then toggle = 1
            cls
        case 1
           span -= rad1*3
            if span <=  +0          then toggle = 0
            cls
    end select
    
loop until inkey <>""
Locked