Vertical raster bars

Post your FreeBASIC tips and tricks here. Please don’t post your code without including an explanation.
angros47
Posts: 1885
Joined: Jun 21, 2005 19:04

Vertical raster bars

Postby angros47 » Jul 21, 2021 10:53

A classic old school effect:

Code: Select all

const w=800
const h=600

screenres w,h,32

dim bar(10) as long         'the vertical raster bar itself

bar(0)=rgb(255,255,0)
for i as integer=1 to 9
   bar(i)=rgb(255,0,0)
next
bar(10)=rgb(128,0,0)


screenlock


do

dim source(w) as long         'the line that will be copied along all the screen

dim p as long ptr=screenptr()

dim t as double=timer         'time variable


for y as integer=1 to h

   dim hpos as integer=w/2+y*.45*sin(t)
   t+=.02

   for i as integer=0 to 10   'Plot the bar on the line buffer
      source(i+hpos)=bar(i)
   next



   dim s as long ptr=@source(0)
   for x as integer= 1 to w
      *p=*s
      p+=1
      s+=1
   next
next
screenunlock
screensync
sleep 100
loop until multikey(1)
      

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 4 guests