home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 14 / IOPROG_14.ISO / soft / sdkjava / dxma.exe / DXMA05.cab / samples / da / java / exercises / HelloBvr / HelloBvr.java next >
Encoding:
Java Source  |  1997-11-13  |  1.0 KB  |  35 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 HelloBvr extends DXMApplet {
  11.   public void init() {
  12.     super.init() ;
  13.     setModel(new HelloBvrModel());
  14.   }
  15. }
  16.  
  17. // The createModel method in this class
  18. // is where you construct your animation.
  19. class HelloBvrModel 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.     // apply the color to the font.
  28.     FontStyleBvr fs = defaultFont.color(textClr);  
  29.     ImageBvr helloImg = stringImage(toBvr("Hello, World"), fs);
  30.     ImageBvr backImg = solidColorImage(blue);
  31.     
  32.     setImage(overlay(helloImg, backImg));
  33.   }
  34. }
  35.