September 27, 2010

Follow Canvas - Module

I have finished a "Follow-Canvas" module using the new Proximity Toolkit. It provides you with a Canvas that aligns itself on a Display so that it keeps the minimal the distance between a specified followed Presence and the FollowCanvas. The main features are:
  • Choose between movement on the border of the display or also allow projection to any position on the display
  • Choose between two strategies for calculating the position. One uses the connection between the Displays and the FollowedPresences Center, projects it into the display plane and places the canvas onto the intersection with the display border. The other one does a projection of the FollowedPresences center onto the display plane and places the canvas to the closest point at the displays border
  • Set a threshold for the movement, so that the canvas only moves when the position-change of the presence exceeds a certain threshold
  • Choose to have animated movement
  • Resize the Canvas by setting its Width and Height, while it automatically repositions.
  • Choose if you want to reposition the canvas center at the border or have the complete canvas inside the display bounds
Here is a simple example of how to let a black box follow a Hat:

DeviceFollowCanvas followCanvas = new DeviceFollowCanvas(displayCanvas, "SmartBoard", "pencil");
followCanvas.Width = 100;
followCanvas.Height = 100;
followCanvas.Background = Brushes.Black;
                                
//additional Settings
followCanvas.PositioningBehaviour = DeviceFollowCanvas.ScreenAlignment.Inside;
followCanvas.AnimatedMovement = true;
followCanvas.AnimatedScaling = false;
followCanvas.MovementAnimationSpeed = .3;
followCanvas.ScalingAnimationSpeed = .3;
followCanvas.AllowProjection = false;
followCanvas.PositionCalculationStrategie = DeviceFollowCanvas.CalculationStrategie.AngleFromCenter;
followCanvas.MovementThreshold = 0.1;

No comments:

Post a Comment