Set display mode 1024,768,32
origcol=rgb(rnd(255),rnd(255),rnd(255))
abcol=rgb(rnd(255),rnd(255),rnd(255))
cdcol=rgb(rnd(255),rnd(255),rnd(255))
abx=rnd(300)+200
aby=rnd(200)-100
cdx=rnd(200)-100
cdy=rnd(300)+200
origx=rnd(300)+100
origy=rnd(300)+100
size=sqrt((cdx*cdx)+(cdy*cdy)+(abx*abx)+(aby*aby))
lock pixels
For x = 0 to size
For y = 0 to size-x
Red=RGBR(origcol)+(((RGBR(abcol)-RGBR(origcol))*x)/size)+(((RGBR(cdcol)-RGBR(origcol))*y)/size)
Green=RGBG(origcol)+(((RGBG(abcol)-RGBG(origcol))*x)/size)+(((RGBG(cdcol)-RGBG(origcol))*y)/size)
Blue=RGBB(origcol)+(((RGBB(abcol)-RGBB(origcol))*x)/size)+(((RGBB(cdcol)-RGBB(origcol))*y)/size)
XPos=0+(x*abx)/size+(y*cdx)/size
YPos=0+(x*aby)/size+(y*cdy)/size
DOT xPos+origx,yPos+origy,RGB(Red,Green,Blue)
DOT xPos+origx+1,yPos+origy,RGB(Red,Green,Blue)
DOT xPos+origx,yPos+origy+1,RGB(Red,Green,Blue)
Next y
Next x
unlock pixels
wait key
Origx,origy: offset position (also position of point 1)
abx,aby: position of point 2 relative to point 1
cdx,cdy: position of point 3 relative to point 1
origcol,abcol,cdcol: Colors of each corner of the triangle.
"I don't like it, and I'm sorry I ever had anything to do with it" - Erwin Schrodinger