|
Here we will use some of the math functions of Basic to draw a hat.
We use the SIN, SQR, and ABS as well as some real number variables. Sorry it isn't very commented but you can change a few numbers and get different characteristics. Also, see if you can make it go any faster. Put a T! = TIMER just after the SCREEN 12 line and then a PRINT T! - TIMER at the end of the listing.
DEFINT A-Z
SCREEN 12
FOR ZI = -64 TO 64
ZT! = ZI * 2.25
ZZ = ZI
XL = .5 + SQR(20736 - ZT! * ZT!)
FOR XI = -XL TO XL
XT! = SQR(XI * XI + ZT! * ZT!) * 3.272492E-02
XX = XI
YY! = (SIN(XT!) + .4 * SIN(3 * XT!)) * 56
X1 = XX + ZZ + 166
Y1 = YY! - ZZ + 100
Y1 = ABS(Y1 - 190)
X1 = X1 + 120
Y1 = Y1 + 120
PSET (X1, Y1), 9
LINE (X1, Y1 + 1)-(X1, 400), 0
NEXT
NEXT
Here's a hint. Change the line above from
PSET (X1, Y1), 9
to
PSET (X1 - 5, Y1), 9
for a shadow effect.
¥
|