
// include various stuff

#include FlashFonts:Halvett.Medium

#include FlashLibrary:Colours

#define SHOW  ShowFrame { }

//#define DEBUGGING

// header info
FileVersion 1

FrameArea {
  width  5400
  height 3000
}

FrameRate 15.0

BgColour WHITE

#ifndef DEBUGGING
// --- INTRO --------------------------------
// define a box that fills the entire screen
Shape {
  id 1
  fillstyle { solid BLACK }   // fillstyle #1
  selectfillstyle0 1
  lineby { 0 3000 }
  lineby { 6000 0 }
  lineby { 0 -3020 }
  lineby { -6000 0 }
}

// put the box on the screen
Place {
  id 1
  depth 100
  matrix { 65536 0 0 }
}
SHOW

// fade in from black to white using a cxform
:for i = 1 to 15
  Place {
    depth 100
    cxform { 255 255 255 255 16*i 16*i 16*i 0 }
  }

  SHOW
:next


// write some text
Text {
  id 2
  style {
    font HALVETT_MEDIUM
    size 1050
    colour BLACK
  }
  text "writeflash"
}

// fade the text in from white to black
:for i = 1 to 15
  Place {
:if i==1
    id 2
:endif
    matrix { 65536 160 600 }
    depth 110
    cxform { 255 255 255 0 0 0 0 16*i+15 }
  }

  SHOW
:next

// wait a second or so
:for i = 0 to 8
  SHOW
:next

// more text
Text {
  id 3
  style {
    font HALVETT_MEDIUM
    size 232
    colour GREY3
  }
  text "A program by Henrik Bjerregaard Pedersen"
}

Place {
  id 3
  depth 120
  matrix { 65536 100 1700 }
}

SHOW

// --- END OF INTRO --------------------------
// --- CLEAR THE SCREEN ----------------------

// wait a few seconds
:for i = 0 to 30
  SHOW
:next

// remove my name...
Remove { depth 120 }

// wait a little while... again...
:for i = 0 to 5
  SHOW
:next

// zoom in on the 'writeflash' text, whilst
// fading it out
:for i = 0 to 9
  Place {
    depth 110
    cxform { 255 255 255 0 0 0 0 25*(9-i)+31 }
    matrix { 65536*(i+1) 500-2000*i 600-300*i }
  }
SHOW
:next

Remove { depth 110 }

SHOW

// --- THE SCREEN IS CLEARED -----------------
#endif
// --- MAKE BUTTON ---------------------------

// more text - this will be used as a link to
// my homepage
Text {
  id 4
  style {
    font HALVETT_MEDIUM
    size 300
    colour RED
  }
  text "My homepage"
}

Text {
  id 7
  style {
    font HALVETT_MEDIUM
    size 300
    colour BLUE
  }
  text "My homepage"
}

// the active area of a button defaults to the
// same as the 'up' of the button, but when this
// is text, it can sometimes be difficult to
// hit the active area, as this is then only the
// filled part of the letters; therefore, we
// create a shape covering approx. the same area
// as the text, and use the for the active area
Shape {
  id 5
  moveto { 0 500 }
  lineby { 2200 0 }
  lineby { 0 -500 }
  lineby { -2200 0 }
  lineby { 0 500 }
}

Button {
  id 6
  up { id 4 depth 40001 }
  over { id 7 depth 40001 }
  activearea { id 5 depth 40001 }
  actions {
    geturl {
      url "http://login.dknet.dk/~henrik"
      target "__new"
    }
  }
}

// put the button on the screen; depth is set
// to something very high, to make sure the
// button is always visible...
Place {
  id 6
  depth 40000
  matrix { 65536 2800 2500 }
}

SHOW

// ------------------------------------------

// a black square
// centered around 0,0 to make rotation easier
Shape {
  id 8
  fillstyle { solid BLACK }
  selectfillstyle0 1
  moveto { -500 -500 }
  lineby { 1000 0 }
  lineby { 0 1000 }
  lineby { -1000 0 }
  lineby { 0 -1000 }
}

:var scale, cx, cs, sn
:for i = 0 to 35
  Place {
:if i == 0
    id 8
:endif
    depth 200
:scale = 6000*(i*i/15+1)
:cs = scale*cos(i*30/100)
:sn = scale*sin(i*30/100)
    matrix { cs cs -sn sn 2700 1500 }
:if i > 25
:cx = (i-25)*25
    cxform { 255 255 255 255 cx cx cx 0 }
:endif
  }
  SHOW
:next

Remove { depth 200 }
SHOW

// ---- WHAT NOW ?? --------------------------
