Author Topic: Colour Wheel  (Read 1299 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Colour Wheel
« on: October 25, 2021 »
Just some colours in wheel fashion.

L/R D-Pad to go.

Code: [Select]
restore rainbow
read cols
dim Rcol(cols)
dim Gcol(cols)
dim Bcol(cols)
dim RGB$(cols)

for a=1 to cols
read Rcol(a)
read Gcol(a)
read Bcol(a)
read RGB$(a)
next a

x=320
y=256
dir=0
ang=pi/180
sides=40
span=360/sides
open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")

if and(c,128)>0 dir=dir-1
if and(c,32)>0 dir=dir+1
if dir>360 dir=1
if dir<1 dir=360

for a=1 to 360 step span
u=cos((dir+a)*ang)*(200)+x
v=sin((dir+a)*ang)*(200)+y
u1=cos((dir+a-span)*ang)*(200)+x
v1=sin((dir+a-span)*ang)*(200)+y

for b=1 to cols
if ((a-1)/span)=b-1 setrgb 1,Rcol(b),Gcol(b),Bcol(b)
next b
fill triangle x,y to u,v to u1,v1

next a

for a=1 to cols
if int(dir/span)+1=40-a then
setrgb 1,0,256,0
else
setrgb 1,256,256,256
endif
text 10,12.5*a,RGB$(a)
next a

setrgb 1,256,256,256
for a=1 to cols
if int(dir/span)+1=40-a text 520,190,RGB$(a)
next a

until (1=2)

label rainbow
data 40
data 169,172,182,"aluminium" rem 000,000,000,"black"
data 000,000,256,"blue"
data 063,033,009,"bronze"
data 150,075,000,"brown"
data 240,220,130,"buff"
data 000,071,171,"cobalt"
data 220,020,060,"crimson"
data 174,096,032,"desert"
data 056,053,051,"dune"
data 256,203,164,"flesh"
data 000,256,000,"green"
data 128,128,128,"grey"
data 063,256,000,"harlequin"
data 079,105,198,"indigo"
data 000,168,107,"jade"
data 240,230,140,"khaki"
data 181,126,220,"lavender"
data 128,000,000,"maroon"
data 129,066,044,"nutmeg"
data 128,128,000,"olive"
data 256,104,031,"orange"
data 256,192,203,"pink"
data 102,000,153,"purple"
data 189,151,142,"quicksand"
data 256,000,000,"red"
data 183,065,014,"rust"
data 256,140,105,"salmon"
data 256,036,000,"scarlet"
data 118,215,234,"skyblue"
data 210,180,140,"tan"
data 000,128,128,"teal"
data 048,213,200,"turquoise"
data 018,010,143,"ultramarine"
data 256,077,000,"vermilion"
data 036,010,064,"violet"
data 119,063,026,"walnut"
data 256,256,256,"white"
data 115,134,120,"xanadu"
data 256,256,000,"yellow"
data 229,132,027,"zest"
data 000,000,000,"black"
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.