home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-08-18 | 1.1 KB | 48 lines |
- ' Gradient circle
- ' ~~~~~~~~~~~~~~~
- ' by Ben Wyatt, bwyatt@paston.co.uk
-
- ' Draws a gradiently filled circle, like in Dpaint, only not as good ;-)
-
- Degree
-
- ' Ask some tricky questions
- Input "Radius (8-100) :";R : R=Min(Max(R,8),100)
- Input "Ditherness (0- 5) :";D : D=Min(Max(D,0),5)
- Flash Off : Curs Off : Cls 0
-
- ' Create a spread of yellow
- For N=0 To 15
- Colour N,N*256+N*16
- Next N
-
- _GRADC[159,99,R,1,15,D]
-
- Wait Key : Edit
-
- Procedure _GRADC[X,Y,R,SCOL,ECOL,DITH]
-
- ' Draws a gradiently filled circle with a centre X,Y and radius R
- ' The colours used range between SCOL and ECOL
- ' DITH=Amount of Ditherness (0->size of range)
-
- ' Get the range
- RA=ECOL-SCOL-DITH
-
- For XT=X-R To X+R
- For YT=Y-R To Y+R
- ' Work out the distance from the centre
- DIST=Sqr((XT-X)*(XT-X)+(YT-Y)*(YT-Y))
- If DIST<=R
- ' Work out the colour and add a bit of randomness to it (DITH)
- C=RA-(DIST*RA)/R
- If DITH>0
- RN=Rnd(DITH)
- If RN=DITH : Add RN,-Rnd(1) : End If
- End If
- Extension_12_036E XT,YT,C+SCOL+RN
- End If
- Next YT
- Next XT
-
- End Proc