## Copper Bars

Do you have something to share with us? A tip for newbies, perhaps? Post it here.
peter
Active Member
Posts: 123
Joined: Mon Oct 22, 2007 2:31 pm

### Copper Bars

Hello,

It's very slow.

Code: Select all

``````SCREEN 640,480

Global yr
yg=40
yb=80

While keydown(27)=0
For i=0 to 240
Color i+15,0,0
Line 0,i,640,i
Color 255-i,0,0
Line 0,i+240,640,i+240
Next i

Color 255,255,255
Text 240,200,"AMIGA COPPER BAR ?"

RedCopper(yr)
GreenCopper(yg)
BlueCopper(yb)

yr = yr+1
yg = yg-1
yb = yb+1
If yr >=480 Then yr=-64
If yg <=-64 Then yg=480
If yb >=480 Then yb=-64

DrawScreen OFF
Wend
End

Function RedCopper(y)
For i=64 to 255 Step 10
Color i,0,0
Line 0,y,639,y
y = y+1
Next i
For i=255 to 64 Step -10
Color i,0,0
Line 0,y,639,y
y = y+1
Next i
End Function

Function GreenCopper(y)
For i=64 to 255 Step 10
Color 0,i,0
Line 0,y,639,y
y = y+1
Next i
For i=255 to 64 Step -10
Color 0,i,0
Line 0,y,639,y
y = y+1
Next i
End Function

Function BlueCopper(y)
For i=64 to 255 Step 10
Color 0,i,i
Line 0,y,639,y
y = y+1
Next i
For i=255 to 64 step -10
Color 0,i,i
Line 0,y,639,y
y = y+1
Next i
End Function
``````

CCE
Artist
Posts: 650
Joined: Mon Aug 27, 2007 9:53 pm

### Re: Copper Bars

It isn't too slow here. In any case, you could make it faster by precalculating the bars as images and then just blitting them in correct places.