Color wheel: Difference between revisions
Content deleted Content added
Applesoft BASIC |
|||
Line 8: | Line 8: | ||
=={{header|Applesoft BASIC}}== |
|||
The lo-resolution GRaphics screen is limited to 16 colors. Ordered dithering is used for the saturation. Pink is mixed with violet and magenta, and aqua is mixed with light blue and green. These lighter colors are randomly mixed with the saturation dither. Note that the four Apple II colors can be seen at the 90 degree marks: orange at 30 degrees, green at 120 degrees, cyan (blue) at 120 degrees, and violet at 300 degrees. |
|||
<lang gwbasic> 100 LET R = 3.1415926535 / 180 |
|||
110 LET YO = 20 |
|||
120 LET XO = YO |
|||
130 LET MS = INT (YO * 7 / 8) |
|||
140 LET O$ = "1111111111.1111111110.1111011110.1101110110.1101010110.1010101010.0010101001.0010001001.0000100001.0000000001.0000000000" |
|||
150 GR |
|||
160 FOR S = 0 TO MS |
|||
170 LET D = S / MS |
|||
180 LET P$ = MID$ (O$, INT (D * 10) * 11 + 1,11) |
|||
190 LET SY = S |
|||
200 LET SX = S * 4 / 7 |
|||
210 LET P = 0 |
|||
220 FOR I = 0 TO 360 |
|||
230 LET X = XO + SIN (I * R) * SX |
|||
240 LET Y = YO + COS (I * R) * SY |
|||
250 LET W = 15 |
|||
260 IF I > = 30 - 22.4 AND I < 30 + 22.5 THEN COLOR= 9 |
|||
270 IF I > = 75 - 22.5 AND I < 75 + 22.5 THEN COLOR= 13 |
|||
280 IF I > = 120 - 22.5 AND I < 120 + 22.5 THEN COLOR= 12:W = 14 |
|||
290 IF I > = 165 - 22.5 AND I < 165 + 22.5 THEN COLOR= 7:W = 14 |
|||
300 IF I > = 210 - 22.5 AND I < 210 + 22.5 THEN COLOR= 6 |
|||
310 IF I > = 255 - 22.5 AND I < 255 + 22.5 THEN COLOR= 2 |
|||
320 IF I > = 300 - 22.5 AND I < 300 + 22.5 THEN COLOR= 3:W = 11 |
|||
330 IF I > = 345 - 22.5 OR I < 345 + 22.5 - 360 THEN COLOR= 1:W = 11 |
|||
340 IF D < .2 THEN W = 15 |
|||
350 IF RND (1) < D THEN W = 15 |
|||
360 IF VAL ( MID$ (P$,P + 1,1)) THEN COLOR= W |
|||
370 IF SCRN( X,Y) = 0 THEN PLOT X,Y:P = P + 1: IF P > = 9 THEN P = 0 |
|||
380 NEXT I,S</lang> |
|||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |
||