// enter program
number blsine a
{
   set b 50
   smaller? a 50
   {
      smaller? a 25
      {
         set b (100-a*a/9+a*a*a/918)
      }
      notsmaller? a 25
      {

         set t (50 - a)
         set b (t*t/9-t*t*t/918)
      }
   }
   notsmaller? a 50
   {
      smaller? a 75
      {
         set t (a-50)
         set b (t*t/9-t*t*t/918)
      }
      notsmaller? a 75
      {
         set t (100 - a)
         set b (100-t*t/9+t*t*t/918)
      }
   }
   value b
}
number blcosine a
{
   value <blsine ((a+25)%100)>
}

set speed 100
set pos 0
pen 100

set mouseXPos <mouse 1>
set mouseYPos <mouse 2>

forever
{
   paper 0
   set pos ((pos + speed) % 10000)
   field (pos/100) 10 (pos/100+10) 20 50
   field ((pos+2000)/100) 10 (pos/100 + 30) 20 50
   smaller? <mouse 1> mouseXPos
   {
      set speed (speed + mouseXPos - <mouse 1>)
   }
   notsmaller? <mouse 1> mouseXPos
   {
      set speed (speed - mouseXPos + <mouse 1>)
   }
   set mouseXPos <mouse 1>
   smaller? <mouse 2> mouseYPos
   {
      set speed (speed + mouseYPos - <mouse 2>)
   }
   notsmaller? <mouse 2> mouseYPos
   {
      set speed (speed - mouseYPos + <mouse 2>)
   }
   set mouseYPos <mouse 2>
   notsmaller? speed 300
   {
      set speed 300
   }
   notsmaller? speed 1
   {
      set speed (speed - 1)
   }
   line 50 50 (8*<blsine (pos/100)>/10+10) (8*<blcosine (pos/100)>/10+10)
}