home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 14 / IOPROG_14.ISO / soft / sdkjava / dxma.exe / DXMA05.cab / samples / da / java / exercises / HelloRBvr / HelloRBvr.java next >
Encoding:
Java Source  |  1997-11-13  |  1.2 KB  |  40 lines

  1. //
  2. // This applet displays a hello message on a blue background,
  3. // with a time varying color.
  4. //
  5. // Copyright (c) 1997 Microsoft Corporation
  6.  
  7. import com.ms.dxmedia.*;
  8.  
  9. // The model you set in this class is the model that will be displayed.
  10. public class HelloRBvr extends DXMApplet {
  11.   public void init() {
  12.     super.init() ;
  13.     setModel(new HelloRBvrModel());
  14.   }
  15. }
  16.  
  17. // The createModel method in this class
  18. // is where you construct your animation.
  19. class HelloRBvrModel extends Model {
  20.  
  21.   // The mode is a hello message with a time varying
  22.   // color over a solid blue background.
  23.   public void createModel(BvrsToRun blist)
  24.   {
  25.     // construct a color in the HSL space with a time varying hue
  26.     ColorBvr textClr = colorHsl(localTime, toBvr(0.5), toBvr(0.5));
  27.     // construct a reactive color which switches to red upon LMB event
  28.     textClr = (ColorBvr)until(textClr, leftButtonDown, red);
  29.  
  30.     // apply the color to the font.
  31.         FontStyleBvr fs = defaultFont.color(textClr);
  32.       
  33.     ImageBvr helloImg = stringImage(toBvr("Hello, World"), fs);
  34.  
  35.     ImageBvr backImg = solidColorImage(blue);
  36.     
  37.     setImage(overlay(helloImg, backImg));
  38.   }
  39. }
  40.