6/8/11

cheap fast screen saver looking "under construction"

if a view isn't ready for "prime time" poking around but people still would like to have a peek - usually it's just easy to throw a transparent rectangle to make it a "read only" view. So, I was just bored and added a screen saver like animation to it. All it is, is a textbox "Under Construction" floating through the screen rotating. Totally half baked but made my QA/Product laugh.

   1:  <Canvas Background="#0C100F0F" x:Name="canvas" Margin="0,0,50,0">
   2:    <Canvas.Triggers>
   3:      <EventTrigger RoutedEvent="TextBlock.Loaded" SourceName="txt">
   4:        <EventTrigger.Actions>
   5:          <BeginStoryboard>
   6:            <Storyboard>
   7:              <DoubleAnimation Storyboard.TargetName="txt" 
   8:                           Storyboard.TargetProperty="(TextBlock.RenderTransform).(RotateTransform.Angle)"
   9:                                                   From="0" To="360" Duration="0:0:50" RepeatBehavior="Forever"/>
  10:                          <DoubleAnimation Storyboard.TargetName="txt" 
  11:                                                   Storyboard.TargetProperty="(Canvas.Left)" 
  12:                                                   From="-25" To="900" Duration="0:0:50" RepeatBehavior="Forever" />
  13:                          <DoubleAnimation Storyboard.TargetName="txt" 
  14:                                                   Storyboard.TargetProperty="(Canvas.Top)" 
  15:                                                   From="-25" To="1250" Duration="0:0:50" RepeatBehavior="Forever" />
  16:            </Storyboard>
  17:          </BeginStoryboard>
  18:              </EventTrigger.Actions>
  19:        </EventTrigger>
  20:    </Canvas.Triggers>
  21:      <TextBlock Name="txt" Text="under construction" Margin="50" Canvas.Left="550" Canvas.Top="450" 
  22:                            FontSize="75" Foreground="Black" Opacity="0.5" Cursor="Hand">
  23:        <TextBlock.RenderTransform>
  24:        <RotateTransform Angle="0" CenterX="75" CenterY="25" />
  25:          </TextBlock.RenderTransform>
  26:      </TextBlock>
  27:  </Canvas>

putting this canvas in a grid or whatever parent should do the trick. oh, adding some special key combination to unlock the view so that qa can test (and making them struggle to find what it is) can make a Friday after 3 p.m. lonely afternoon with tumbleweeds rolling through abandoned cubicals more exciting.
To make rotations cooler, I should add dependency properties in the back .cs that would bind to Canvas' Left.From, Left.To, Right.From, etc... and make sure they are generating new values. So that the rotation is random. But that's for the next boring afternoon.

No comments:

Post a Comment