REM -- Europe Demo by Parabellum (april 2002)

open window 640,512
window origin "lb"

dim A1(6)
dim A2(6)
dim ms(6)

rem INITIALISATIONS --------------------------------------

data 72,1368,360,216,648,504,936,792,1224,1080

for i=1 to 5
  read A1(i) : read A2(i)
next i
A2(6) = A2(1)

dim _sin(1440)
dim _cos(1440)
dim msin(1440)
dim mcos(1440)
dim rsin(1440)
dim rcos(1440)

c = 220/6     rem # star size multiplier

for i=0 to 1440
  b = i * PI / 720
  _sin(i) = sin(b)
  _cos(i) = cos(b)
  rcos(i) = c * cos(b)
  rsin(i) = c * sin(b)
  mcos(i) = c * cos(b) * .4
  msin(i) = c * sin(b) * .4
next i

ba = 1     rem # init background counters
bd = 0.02  rem # init background counters

label LOOP rem -------------------------------------------

  setdrawbuf 1 - draw

  gosub drawBackground
  gosub logo
  gosub drawLines

  draw = 1 - draw
  setdispbuf draw

  a = mod( a+1, 1440)

goto LOOP rem --------------------------------------------

'|=====================================================
'| Draw a gradient background
'|

LABEL drawBackground
  ba = ba + bd
  if ba>6 bd=-bd
  if ba<1 bd=-bd
  b = cos(ba)
  i = sin(ba)
  x1 = 320 + 80 * sin(7*ba)
  x2 = 320 + 80 * cos(7*ba)
  y1 = 256 + 102 * i * cos(2.3*ba)
  y2 = 256 + 102 * b * sin(2.3*ba)
  b = 20 * b * i
  setrgb 1, 0,0, 50 + 30 * cos(0.5*ba*ba)
  setrgb 2, 0,0,b
  setrgb 3, 0,0,80
  gtriangle x1,0 to 640,y2 to 640,0
  gtriangle x2,512 to 640,y2 to 640,512
  setrgb 3, 0,0,b
  gtriangle x1,0 to 640,y2 to 0,y1
  gtriangle x2,512 to 640,y2 to 0,y1
  setrgb 2, 0,0,50
  gtriangle x1,0 to 0,0 to 0,y1
  gtriangle x2,512 to 0,512 to 0,y1
return

'|=====================================================
'| Draw the 12 stars
'|

rem -- 0.146875 = (235/1440) * .9
rem -- 1520 = 4 * 380

LABEL drawLines

turn = mod(turn+1438,1440)

for b=1 to 12

  turn = mod( turn+120, 1440)
  x0 = 320 + 190 * _cos(turn)
  y0 = 256 + 190 * _sin(turn)

  for i=1 to 5

    _a = mod( a+A1(i), 1440)
    x1 = x0 + rcos(_a)
    y1 = y0 + rsin(_a)
    _a = mod( a+A2(i), 1440)
    x2 = x0 + mcos(_a)
    y2 = y0 + msin(_a)
    c = abs( mod( _a+950, 1440) - 720)  
    c = 20 + c * 0.146875
    setrgb 1, c,c,0
    fill triangle x0,y0 to x1,y1 to x2,y2

    _a = mod( a+A2(i+1), 1440)
    x2 = x0 + mcos(_a)
    y2 = y0 + msin(_a)
    c = abs( mod( _a+850, 1440) - 720)
    c = 20 + c * 0.146875
    setrgb 1, c,c,0 
    fill triangle x0,y0 to x1,y1 to x2,y2

  next i

next b

RETURN

'|=====================================================
'| The EURO logo
'|

Label logo

  m = 23 * _sin(mod(2*turn,1440))
  if (m < 2) return

  ms(0) = 5*m
  ms(1) = 3*m
  ms(2) = m
  ms(3) = -m
  ms(4) = -3*m
  ms(5) = -5*m

  SETRGB 1,0,0,80/23*m

  x = 320 - m * 10.5
  y = 256

  y0 = y+ms(0)
  y1 = y+ms(1)
  y2 = y+ms(2)
  y3 = y+ms(3)
  y4 = y+ms(4)
  y5 = y+ms(5)

rem ****** E ******

  x1 = x+ms(1)
  x2 = x+ms(2)
  x3 = x+ms(3)
  x4 = x+ms(4)

  fill triangle x4,y0 to x4,y5 to x3,y0
  fill triangle x3,y5 to x4,y5 to x3,y0

  fill triangle x3,y0 to x1,y0 to x3,y1
  fill triangle x1,y1 to x1,y0 to x3,y1

  fill triangle x3,y2 to x2,y2 to x3,y3
  fill triangle x2,y3 to x2,y2 to x3,y3

  fill triangle x3,y5 to x1+2*m,y5 to x3,y4
  fill triangle x1,y4 to x1+2*m,y5 to x3,y4

rem ****** U ******

  x = x + m * 7

  x1 = x+ms(1)
  x2 = x+ms(2)
  x3 = x+ms(3)
  x4 = x+ms(4)

  fill triangle x4,y4 to x4,y0 to x3,y5
  fill triangle x3,y0 to x4,y0 to x3,y5

  fill triangle x3,y4 to x3,y5 to x2,y4
  fill triangle x2,y5 to x3,y5 to x2,y4

  fill triangle x2,y5 to x2,y0 to x1,y5
  fill triangle x1,y0+m to x2,y0 to x1,y5

rem ****** R ******

  x = x + m * 7

  x1 = x+ms(1)
  x2 = x+ms(2)
  x3 = x+ms(3)
  x4 = x+ms(4)

  fill triangle x4,y0 to x4,y5 to x3,y0
  fill triangle x3,y5 to x4,y5 to x3,y0

  fill triangle x3,y0 to x3,y1 to x1,y0
  fill triangle x1,y1 to x3,y1 to x1,y0

  fill triangle x2,y1 to x1,y2 to x1,y1
  fill triangle x2,y1 to x1,y2 to x2,y3

  fill triangle x2,y5 to x1,y4 to x2,y3
  fill triangle x2,y4 to x3,y3 to x2,y2
  fill triangle x2,y5 to x1,y4 to x1,y5-2*m

rem ****** O ******

  x = x + m * 7

  x1 = x+ms(1)
  x2 = x+ms(2)
  x3 = x+ms(3)
  x4 = x+ms(4)

  fill triangle x4,y0 to x4,y4 to x3,y0
  fill triangle x3,y5 to x4,y4 to x3,y0

  fill triangle x3,y4 to x3,y5 to x2,y4
  fill triangle x2,y5 to x3,y5 to x2,y4

  fill triangle x3,y0 to x3,y1 to x2,y0
  fill triangle x2,y1 to x3,y1 to x2,y0

  fill triangle x2,y0 to x2,y5 to x1,y1
  fill triangle x1,y5 to x2,y5 to x1,y1

return




