Frankly speaking since WPF was introduced every thing I do I feel its an animation!!
 I used Kevin's (A guy who worked with me in my earlier company) Kinetic scrolling in my card game to display player names which was cool. I also used similar model to create a iphone like slider(the one which is used to unlock iphone).
Following is an excerpt from the code. Other events are similar to Kevin's scrolling example.
Here the endposition is the x coordinate of the rectangle which contains the sliding canvas.
protected override void OnPreviewMouseMove(MouseEventArgs e)
 {
   if (slidecanvas.IsMouseCaptured)
    {                           
                end = e.GetPosition(this);
                if (end.X >= endposition)
                {
                    slidecanvas.ReleaseMouseCapture();
                    story1.Begin(this);
                    return;
                }
                double diff = end.X - start.X;
                if (diff > 0)
                {                  
                    TimeSpan time = etime - stime;
                    story = (Storyboard)FindResource("Timeline2");
                    DoubleAnimation anim = (DoubleAnimation)story.Children[0];
                    anim.To = start.X + diff;
                    anim.Duration = time;                   
                    story.Begin(this);
                }
       }
}
Iphone like unlock screen
 
 
 
 
No comments :
Post a Comment
Leave a Comment...