Page 1 of 1

### Easter Eggs

Posted: Fri Mar 30, 2018 6:10 pm
The egg shapes are created with DRAW CIRCLE. The 3D effect is generated entirely by shading. The SHADOW command is not used.

HAPPY EASTER!

Code: Select all

``````SET TOOLBAR OFF
GET SCREEN SIZE sw, sh
GRAPHICS
GRAPHICS CLEAR 0,0,0
FOR t = 1 TO 40
hue=RND(1)
SIZE=RND(30)+10+t*2
x=SIZE+RND(sw-2*SIZE)
y=SIZE+RND(sh-2*SIZE)
FOR u=SIZE TO 1 STEP-1
pal(hue,.6,1,1-u/(3*SIZE))  ' this is the line that creates the shading on each egg
FILL COLOR pal.r,pal.g,pal.b
FILL CIRCLE X,Y SIZE SIZE*(u/SIZE),SIZE*(u/SIZE)*.7
NEXT u
PAUSE .1
NEXT t
PAUSE 5
END

' condensed version of Dutchman's Palet function
'g'!DEF pal(tnt,sat,brt,iny)!tnt%=1
sat=ABS(sat)!IF sat>1 THEN sat%=1
iny=ABS(iny)!IF iny>1 THEN iny%=1
brt=ABS(brt)!IF brt>1 THEN brt%=1
tnt*=6!sect=INT(0.5+tnt)!tnt%=1
ON sect GOTO s1,s2,s3,s4,s5,s6
s1:b=1!r=0!g=tnt!GOTO satr
s2:g=1!r=0!b=1-tnt!GOTO satr
s3:g=1!b=0!r=tnt!GOTO satr
s4:r=1!b=0!g=1-tnt!GOTO satr
s5:r=1!g=0!b=tnt!GOTO satr
s6:b=1!g=0!r=1-tnt!satr:IF sat<1 THEN
y=0.3*r+0.59*g+0.11*b!u=b-Y!u*=sat
v=r-Y!v*=sat!w=g-Y!w*=sat!r=y+v!g=y+w!b=y+u
IF brt<>0 THEN!ysup=1-MAX(MAX(r,g),b)
ysup*=brt!r+=ysup!g+=ysup!b+=ysup!ENDIF!ENDIF
IF iny<1 THEN!r*=iny!g*=iny!b*=iny!ENDIF
y=0.3*r+0.59*g+0.11*b!ENDDEF
``````