예제 #1
0
 public DLPointAnimation(Point fromValue, Point toValue, Duration duration, Action<object> frameCallback, IEasingFunction easingFunction = null)
 {
     FrameCallback = frameCallback;
     _point = new AnimationPoint();
     _pointAnimation = new PointAnimation(fromValue, toValue, duration);
     if (easingFunction != null)
     {
         _pointAnimation.EasingFunction = easingFunction;
     }
     _pointAnimation.Completed += (sender, args) =>
         {
             FrameCallback(_pointAnimation.To);
             _point.BeginAnimation(AnimationPoint.PointProperty, null);
         };
 }
예제 #2
0
        public static void ApplyPointAnimation(Storyboard existingStoryBoard, DependencyObject target, String targetName, 
            String propertyName, Point oldPoint, Point newPoint, Double animationTime, Double beginTime)
        {
            PointAnimation pointAnimation = new PointAnimation();

            pointAnimation.From = oldPoint;
            pointAnimation.To = newPoint;
            pointAnimation.SpeedRatio = 2;
            pointAnimation.Duration = new Duration(new TimeSpan(0, 0, 0, (int) animationTime * 1000));
            //pointAnimation.BeginTime = new TimeSpan(0, 0, 0, (int)beginTime * 1000);

            target.SetValue(FrameworkElement.NameProperty, targetName);

            Storyboard.SetTarget(pointAnimation, target);
            Storyboard.SetTargetProperty(pointAnimation, new PropertyPath(propertyName));
            Storyboard.SetTargetName(pointAnimation, (String)target.GetValue(FrameworkElement.NameProperty));
            
            existingStoryBoard.Children.Add(pointAnimation);
        }
예제 #3
0
        /// <summary>
        /// Enlarges a SVI to go mid-screen
        /// </summary>
        /// <param name="left"></param>
        private void EnlargeForSide(Boolean left)
        {
            MainDesktop.Photos.Items.Remove(SessionVM.SessionSVI);
            MainDesktop.Sessions.Items.Add(SessionVM.SessionSVI);
            if (left) MainDesktop.LeftSessionActive = true;
            else MainDesktop.RightSessionActive = true;
            MainDesktop.CheckDesktopToDisplay();

            #region Animation Settings
            Storyboard stb = new Storyboard();
            PointAnimation centerPosAnimation = new PointAnimation();
            DoubleAnimation heightAnimation = new DoubleAnimation();
            EnlargeWidthAnimation = new DoubleAnimation();
            DoubleAnimation orientationAnimation = new DoubleAnimation();
            ThicknessAnimation borderAnimation = new ThicknessAnimation();

            if (MainDesktop.LeftSessionActive && SessionVM.Orientation == "right")
                centerPosAnimation.From = new Point(SessionVM.SessionSVI.ActualCenter.X + 607.5, SessionVM.SessionSVI.ActualCenter.Y);
            else
                centerPosAnimation.From = SessionVM.SessionSVI.ActualCenter;
            if(left) centerPosAnimation.To = new System.Windows.Point(MainDesktop.ActualWidth / 6.0 - 16.875, MainDesktop.ActualHeight / 2.0);
            else centerPosAnimation.To = new System.Windows.Point(5.0 * MainDesktop.ActualWidth / 6.0 + 16.875, MainDesktop.ActualHeight / 2.0);
            centerPosAnimation.Duration = new Duration(TimeSpan.FromSeconds(.75));
            centerPosAnimation.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(centerPosAnimation);
            Storyboard.SetTarget(centerPosAnimation, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(centerPosAnimation, new PropertyPath(ScatterViewItem.CenterProperty));

            if (left)
            {
                orientationAnimation.From = SessionVM.SessionSVI.ActualOrientation;
                if (SessionVM.SessionSVI.ActualOrientation <= 180)
                    orientationAnimation.To = 90;
                else
                    orientationAnimation.To = 90 + 360;
            }
            else
            {
                orientationAnimation.From = SessionVM.SessionSVI.ActualOrientation;
                if (SessionVM.SessionSVI.ActualOrientation <= 180)
                    orientationAnimation.To = -90;
                else
                    orientationAnimation.To = -90 + 360;
            }
            orientationAnimation.Duration = new Duration(TimeSpan.FromSeconds(.75));
            orientationAnimation.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(orientationAnimation);
            Storyboard.SetTarget(orientationAnimation, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(orientationAnimation, new PropertyPath(ScatterViewItem.OrientationProperty));

            heightAnimation.From = SessionVM.SessionSVI.ActualHeight;
            heightAnimation.To = (MainDesktop.ActualHeight + 120.0) * 0.5625;
            heightAnimation.Duration = new Duration(TimeSpan.FromSeconds(1));
            heightAnimation.EasingFunction = new ExponentialEase();
            heightAnimation.AccelerationRatio = 1;
            heightAnimation.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(heightAnimation);
            Storyboard.SetTarget(heightAnimation, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(heightAnimation, new PropertyPath(ScatterViewItem.HeightProperty));

            EnlargeWidthAnimation.From = SessionVM.SessionSVI.ActualWidth;
            EnlargeWidthAnimation.To = (MainDesktop.ActualWidth + 120.0) * 0.5625;
            EnlargeWidthAnimation.Duration = new Duration(TimeSpan.FromSeconds(1));
            EnlargeWidthAnimation.EasingFunction = new ExponentialEase();
            EnlargeWidthAnimation.AccelerationRatio = 1;
            EnlargeWidthAnimation.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(EnlargeWidthAnimation);
            Storyboard.SetTarget(EnlargeWidthAnimation, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(EnlargeWidthAnimation, new PropertyPath(ScatterViewItem.WidthProperty));

            borderAnimation.From = new Thickness(15.0);
            borderAnimation.To = new Thickness(60.0 * 0.5625);
            borderAnimation.Duration = new Duration(TimeSpan.FromSeconds(1));
            borderAnimation.FillBehavior = FillBehavior.HoldEnd;
            stb.Children.Add(borderAnimation);
            Storyboard.SetTarget(borderAnimation, SessionVM.SessionSVI);
            Storyboard.SetTargetProperty(borderAnimation, new PropertyPath(ScatterViewItem.BorderThicknessProperty));

            #endregion

            EnlargeWidthAnimation.Completed += new EventHandler(stb_enlarge_Completed);
            stb.Begin(SessionVM.Grid);
        }
예제 #4
0
        void newItemSVI_PreviewTouchUp(object sender, TouchEventArgs e)
        {
            //Vergrößern/Verkleinern des gewählten Dokuments durch TouchEvent

            ScatterViewItem displayedItem = (sender as ScatterViewItem);

            double targetwidth = 758;
            double targetheight = 1080;
            Point targetcenter = new Point(490, 390);

            double initialwidth = 491;
            double initialheight = 700;
            Point initialcenter = new Point(400, 390);
            double duration = .25;

            //Vergrößern, wenn Darstellung klein ist.
            if (displayedItem.Height == 700)
            {
                targetheight = 1080;
                targetwidth = 758;
                targetcenter = new Point(400, 390);

                initialwidth = 491;
                initialheight = 700;
                initialcenter = new Point(490, 390);

                displayedItem.Height = targetheight;
                displayedItem.Width = targetwidth;
                displayedItem.Center = targetcenter;

                //Menübuttons deaktivieren
                _hauptformular.button1.IsEnabled = false;
                _hauptformular.button2.IsEnabled = false;
                _hauptformular.button3.IsEnabled = false;
                _hauptformular.button4.IsEnabled = false;
                _hauptformular.homeButton.IsEnabled = false;
                _hauptformular.button6.IsEnabled = false;
                _hauptformular.button7.IsEnabled = false;

            }
            //Verkleiner, wenn Darstellung groß ist.
            else
            {
                targetheight = 700;
                targetwidth = 491;
                targetcenter = new Point(490, 390);

                initialwidth = 758;
                initialheight = 1080;
                initialcenter = new Point(400, 390);

                displayedItem.Height = 700;
                displayedItem.Width = 491;
                displayedItem.Center = new Point(490, 390);

                //Menüttons, bis auf den Infoscreen Button aktivieren
                _hauptformular.button1.IsEnabled = true;
                _hauptformular.button2.IsEnabled = true;
                _hauptformular.button3.IsEnabled = true;
                _hauptformular.button4.IsEnabled = true;
                _hauptformular.homeButton.IsEnabled = false;
                _hauptformular.button6.IsEnabled = true;
                _hauptformular.button7.IsEnabled = true;

            }
            //Animation ausführen
            DoubleAnimation animX = new DoubleAnimation(initialwidth, targetwidth, new Duration(TimeSpan.FromSeconds(duration)), FillBehavior.Stop);
            DoubleAnimation animY = new DoubleAnimation(initialheight, targetheight, new Duration(TimeSpan.FromSeconds(duration)), FillBehavior.Stop);
            PointAnimation animCenter = new PointAnimation(initialcenter, targetcenter, new Duration(TimeSpan.FromSeconds(duration)), FillBehavior.Stop);

            displayedItem.BeginAnimation(ScatterViewItem.WidthProperty, animX);
            displayedItem.BeginAnimation(ScatterViewItem.HeightProperty, animY);
            displayedItem.BeginAnimation(ScatterViewItem.CenterProperty, animCenter);
        }
예제 #5
0
        private static void UpdateXAndYValue(DataPoint dataPoint, Canvas line2dLabelCanvas)
        {
            Boolean isAnimationEnabled = (Boolean)(dataPoint.Chart as Chart).AnimatedUpdate;

            if (!(Boolean)dataPoint.Enabled || dataPoint.Faces == null)
                return;

            Chart chart = dataPoint.Chart as Chart;
            DataSeries dataSeries = dataPoint.Parent;
            dataSeries._movingMarker.Visibility = Visibility.Collapsed;

            Axis axisX = dataSeries.PlotGroup.AxisX;
            Axis axisY = dataSeries.PlotGroup.AxisY;

            Marker dataPointMarker = dataPoint.Marker;
            Marker legendMarker = dataPoint.LegendMarker;
            
            Double height = chart.ChartArea.ChartVisualCanvas.Height;
            Double width = chart.ChartArea.ChartVisualCanvas.Width;

            Double x = Graphics.ValueToPixelPosition(0, width, axisX.InternalAxisMinimum, axisX.InternalAxisMaximum, dataPoint.InternalXValue);
            Double y = Graphics.ValueToPixelPosition(height, 0, axisY.InternalAxisMinimum, axisY.InternalAxisMaximum, dataPoint.InternalYValue);

            //Get coordinates of the previous DataPoint
            Double xPrevious = x;
            Double yPrevious = y;

            if (dataPoint.Faces.PreviousDataPoint != null)  //If previous DataPoint is present
            {
                xPrevious = Graphics.ValueToPixelPosition(0, width, axisX.InternalAxisMinimum, axisX.InternalAxisMaximum, dataPoint.Faces.PreviousDataPoint.InternalXValue);
                yPrevious = Graphics.ValueToPixelPosition(height, 0, axisY.InternalAxisMinimum, axisY.InternalAxisMaximum, dataPoint.Faces.PreviousDataPoint.InternalYValue);
            }

            //Gets coordinates of the DataPoint next to current DataPoint
            Double xNext = x;
            Double yNext = y;
            
            if (dataPoint.Faces.NextDataPoint != null)  //If next DataPoint is present
            {
                xNext = Graphics.ValueToPixelPosition(0, width, axisX.InternalAxisMinimum, axisX.InternalAxisMaximum, dataPoint.Faces.NextDataPoint.InternalXValue);
                yNext = Graphics.ValueToPixelPosition(height, 0, axisY.InternalAxisMinimum, axisY.InternalAxisMaximum, dataPoint.Faces.NextDataPoint.InternalYValue);
            }

            dataPoint._visualPosition = new Point(x, y);
            Point newMarkerPosition = new Point();
            Point newLabelPosition = new Point();

            if (dataPointMarker != null)
                newMarkerPosition = dataPointMarker.CalculateActualPosition(x, y, new Point(0.5, 0.5));

            if ((Boolean)dataPoint.LabelEnabled)
            {
                if (isAnimationEnabled && dataPoint.LabelVisual != null)
                {
                    dataPoint._oldLabelPosition = new Point((Double)dataPoint.LabelVisual.GetValue(Canvas.LeftProperty), (Double)dataPoint.LabelVisual.GetValue(Canvas.TopProperty));
                    newLabelPosition = CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, x, y, ref line2dLabelCanvas, false);

                    dataPoint.LabelVisual.SetValue(Canvas.TopProperty, dataPoint._oldLabelPosition.Y);
                    dataPoint.LabelVisual.SetValue(Canvas.LeftProperty, dataPoint._oldLabelPosition.X);
                }
                else
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, x, y, ref line2dLabelCanvas, true);
            }

            if (!isAnimationEnabled)
            {
                if (dataPointMarker != null && dataPointMarker.Visual != null)
                {
                    dataPointMarker.Visual.SetValue(Canvas.TopProperty, newMarkerPosition.Y);
                    dataPointMarker.Visual.SetValue(Canvas.LeftProperty, newMarkerPosition.X);
                }
            }

            DependencyObject target, shadowTarget = null;    // Target object
            Point oldPoint = new Point();                    // Old Position
            Point newPoint = new Point();                    // New Position 
            Point shadowOldPoint = new Point();

            // Collect reference of line geometry object
            LineSegment lineSeg1 = dataPoint.Faces.Parts[0] as LineSegment;     //Line Segment from previous DataPoint to Step point.
            LineSegment lineSeg2 = dataPoint.Faces.Parts[1] as LineSegment;     //Line Segment from Step point to the current DataPoint.
            LineSegment nextLineSeg1 = lineSeg2;                                //Line Segment from current DataPoint to next Step point.
            
            if (dataPoint.Faces.NextDataPoint != null)      //If next DataPoint is present
            {
                nextLineSeg1 = dataPoint.Faces.NextDataPoint.Faces.Parts[0] as LineSegment;
            }

            //If previous Data point is not present, Faces[1] is PathFigure, else Faces[2] is the PathFigure
            PathFigure pathFigure = dataPoint.Faces.Parts[1] as PathFigure;     
            if (dataPoint.Faces.PreviousDataPoint != null)
            {
                pathFigure = dataPoint.Faces.Parts[2] as PathFigure;
            }

            LineSegment shadowLineSeg1;                         //Shadow Line Segment from previous DataPoint to Step point.
            LineSegment shadowLineSeg2;                         //Shadow Line Segment from Step point to the current DataPoint.
            LineSegment nextShadowLineSeg1;                     //Shadow Line Segment from current DataPoint to next Step point.

            PathFigure shadowPathFigure;

            if (!VisifireControl.IsMediaEffectsEnabled)
            {
                // For line shadow
                if ((Boolean)dataPoint.Parent.ShadowEnabled)
                {
                    shadowLineSeg1 = dataPoint.ShadowFaces.Parts[0] as LineSegment;
                    shadowLineSeg2 = dataPoint.ShadowFaces.Parts[1] as LineSegment;

                    nextShadowLineSeg1 = shadowLineSeg2;
                    if (dataPoint.Faces.NextDataPoint != null)
                    {
                        nextShadowLineSeg1 = dataPoint.Faces.NextDataPoint.ShadowFaces.Parts[0] as LineSegment;
                    }

                    shadowPathFigure = dataPoint.ShadowFaces.Parts[1] as PathFigure;
                    if (dataPoint.Faces.PreviousDataPoint != null)
                    {
                        pathFigure = dataPoint.ShadowFaces.Parts[2] as PathFigure;
                    }

                    if (shadowLineSeg1 == null)
                    {
                        shadowOldPoint = shadowPathFigure.StartPoint;
                        shadowTarget = shadowPathFigure;
                        if (!isAnimationEnabled)
                        {
                            shadowPathFigure.StartPoint = new Point(x, y);
                            nextShadowLineSeg1.Point = new Point(xNext, y);
                        }
                    }
                    else
                    {
                        shadowTarget = shadowLineSeg2;
                        shadowOldPoint = shadowLineSeg2.Point;
                        if (!isAnimationEnabled)
                        {
                            shadowLineSeg1.Point = new Point(x, yPrevious);
                            shadowLineSeg2.Point = new Point(x, y);
                            nextShadowLineSeg1.Point = new Point(xNext, y);
                        }
                    }
                }
            }

            if (lineSeg1 == null)
            {
                target = pathFigure;

                if (isAnimationEnabled)
                {
                    if (dataPoint.Storyboard != null)
                        dataPoint.Storyboard.Pause();

                    oldPoint = pathFigure.StartPoint;
                    // pathFigure.StartPoint = new Point(x, y);
                    
                }
                else
                {
                    pathFigure.StartPoint = new Point(x, y);
                    
                    if(nextLineSeg1 != null)
                        nextLineSeg1.Point = new Point(xNext, y);
                }
                    
            }
            else
            {
                target = lineSeg2;
                oldPoint = lineSeg2.Point;

                if (isAnimationEnabled)
                {
                    if (dataPoint.Storyboard != null)
                        dataPoint.Storyboard.Pause();

                    // oldPoint = lineSeg2.Point;
                }
                else
                {
                    lineSeg1.Point = new Point(x, yPrevious);
                    lineSeg2.Point = new Point(x, y);
                    nextLineSeg1.Point = new Point(xNext, y);
                }
            }

            if (isAnimationEnabled)
            {
                #region Apply Animation to the DataPoint

                Storyboard storyBorad = new Storyboard();

                newPoint = new Point(x, y);
                target = pathFigure;
                if (lineSeg2 != null)
                {
                    target = lineSeg2;
                }

                //Animate the current data point.
                PointAnimation pointAnimation2 = new PointAnimation();
                pointAnimation2.From = oldPoint;
                pointAnimation2.To = newPoint;
                pointAnimation2.SpeedRatio = 2;
                pointAnimation2.Duration = new Duration(new TimeSpan(0, 0, 1));

                Storyboard.SetTarget(pointAnimation2, target);
                Storyboard.SetTargetProperty(pointAnimation2, (lineSeg2 != null) ? new PropertyPath("Point") : new PropertyPath("StartPoint"));
                Storyboard.SetTargetName(pointAnimation2, (String)target.GetValue(FrameworkElement.NameProperty));
                storyBorad.Children.Add(pointAnimation2);

                //Animate the Step point next to current DataPoint
                PointAnimation pointAnimation3 = new PointAnimation();
                pointAnimation3 = pointAnimation2;
                if (dataPoint.Faces.NextDataPoint != null)
                {
                    newPoint = new Point(xNext, y);
                    target = nextLineSeg1;
                    pointAnimation3 = new PointAnimation();
                    pointAnimation3.From = nextLineSeg1.Point;
                    pointAnimation3.To = newPoint;
                    pointAnimation3.SpeedRatio = 2;
                    pointAnimation3.Duration = new Duration(new TimeSpan(0, 0, 1));

                    Storyboard.SetTarget(pointAnimation3, target);
                    Storyboard.SetTargetProperty(pointAnimation3, (nextLineSeg1 != null) ? new PropertyPath("Point") : new PropertyPath("StartPoint"));
                    Storyboard.SetTargetName(pointAnimation3, (String)target.GetValue(FrameworkElement.NameProperty));
                    storyBorad.Children.Add(pointAnimation3);
                }

                if (!VisifireControl.IsMediaEffectsEnabled)
                {
                    if (shadowTarget != null)
                    {

                        shadowLineSeg1 = dataPoint.ShadowFaces.Parts[0] as LineSegment;
                        shadowLineSeg2 = dataPoint.ShadowFaces.Parts[1] as LineSegment;
                        nextShadowLineSeg1 = shadowLineSeg2;
                        if (dataPoint.Faces.NextDataPoint != null)
                        {
                            nextShadowLineSeg1 = dataPoint.Faces.NextDataPoint.ShadowFaces.Parts[0] as LineSegment;
                        }

                        shadowPathFigure = dataPoint.ShadowFaces.Parts[1] as PathFigure;
                        if (dataPoint.Faces.PreviousDataPoint != null)
                        {
                            pathFigure = dataPoint.ShadowFaces.Parts[2] as PathFigure;
                        }

                        shadowTarget = shadowPathFigure;
                        if (shadowLineSeg1 != null)
                        {
                            shadowTarget = shadowLineSeg2;
                        }

                        newPoint = new Point(x, y);
                        PointAnimation pointAnimationS2 = new PointAnimation();
                        pointAnimationS2.From = shadowOldPoint;
                        pointAnimationS2.To = newPoint;
                        pointAnimationS2.SpeedRatio = 2;
                        pointAnimationS2.Duration = new Duration(new TimeSpan(0, 0, 1));

                        //shadowTarget.SetValue(FrameworkElement.NameProperty, "ShadowSegment_" + dataPoint.Name);

                        Storyboard.SetTarget(pointAnimationS2, shadowTarget);
                        Storyboard.SetTargetProperty(pointAnimationS2, (shadowLineSeg2 != null) ? new PropertyPath("Point") : new PropertyPath("StartPoint"));
                        Storyboard.SetTargetName(pointAnimationS2, (String)shadowTarget.GetValue(FrameworkElement.NameProperty));

                        storyBorad.Children.Add(pointAnimationS2);

                        PointAnimation pointAnimationS3 = new PointAnimation();
                        pointAnimationS3 = pointAnimationS2;
                        if (dataPoint.Faces.NextDataPoint != null)
                        {
                            newPoint = new Point(xNext, y);
                            shadowTarget = nextShadowLineSeg1;
                            pointAnimationS3 = new PointAnimation();
                            pointAnimationS3.From = nextShadowLineSeg1.Point;
                            pointAnimationS3.To = newPoint;
                            pointAnimationS3.SpeedRatio = 2;
                            pointAnimationS3.Duration = new Duration(new TimeSpan(0, 0, 1));

                            //shadowTarget.SetValue(FrameworkElement.NameProperty, "ShadowSegment_" + dataPoint.Name);

                            Storyboard.SetTarget(pointAnimationS3, shadowTarget);
                            Storyboard.SetTargetProperty(pointAnimationS3, (nextShadowLineSeg1 != null) ? new PropertyPath("Point") : new PropertyPath("StartPoint"));
                            Storyboard.SetTargetName(pointAnimationS3, (String)shadowTarget.GetValue(FrameworkElement.NameProperty));
                            storyBorad.Children.Add(pointAnimationS3);
                        }

#if WPF
                        if (shadowLineSeg1 != null && nextShadowLineSeg1 != null)
                        {
                            (shadowLineSeg2 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimationS2);
                            (nextShadowLineSeg1 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimationS3);
                        }
                        else if (nextShadowLineSeg1 == null && shadowLineSeg1 != null)
                        {
                            (shadowLineSeg2 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimationS2);
                        }
                        else
                        {
                            (shadowPathFigure as PathFigure).BeginAnimation(PathFigure.StartPointProperty, pointAnimationS2);
                            (nextShadowLineSeg1 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimationS3);
                        }
#endif
                    }
                }

                #endregion

                #region Attach Animation with Marker

                FrameworkElement marker = dataPoint.Marker.Visual;

                if (marker != null)
                {
                    // Animation for (Canvas.Top) property
                    DoubleAnimation da = new DoubleAnimation()
                    {
                        From = (Double)marker.GetValue(Canvas.LeftProperty),
                        To = newMarkerPosition.X,
                        Duration = new Duration(new TimeSpan(0, 0, 1)),
                        SpeedRatio = 2
                    };

                    Storyboard.SetTarget(da, marker);
                    Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Left)"));
                    Storyboard.SetTargetName(da, (String)marker.GetValue(FrameworkElement.NameProperty));

                    storyBorad.Children.Add(da);

                    // Animation for (Canvas.Top) property
                    da = new DoubleAnimation()
                    {
                        From = (Double)marker.GetValue(Canvas.TopProperty),
                        To = newMarkerPosition.Y,
                        Duration = new Duration(new TimeSpan(0, 0, 1)),
                        SpeedRatio = 2
                    };

                    Storyboard.SetTarget(da, marker);
                    Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
                    Storyboard.SetTargetName(da, (String)marker.GetValue(FrameworkElement.NameProperty));

                    storyBorad.Children.Add(da);
                }

                #endregion

                #region Attach Animation with Label

                FrameworkElement label = dataPoint.LabelVisual;

                if (label != null)
                {
                    // Animation for (Canvas.Top) property
                    DoubleAnimation da = new DoubleAnimation()
                    {
                        From = dataPoint._oldLabelPosition.X,
                        To = newLabelPosition.X,
                        Duration = new Duration(new TimeSpan(0, 0, 1)),
                        SpeedRatio = 2
                    };

                    Storyboard.SetTarget(da, label);
                    Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Left)"));
                    Storyboard.SetTargetName(da, (String)label.GetValue(FrameworkElement.NameProperty));

                    storyBorad.Children.Add(da);

                    // Animation for (Canvas.Top) property
                    da = new DoubleAnimation()
                    {
                        From = dataPoint._oldLabelPosition.Y,
                        To = newLabelPosition.Y,
                        Duration = new Duration(new TimeSpan(0, 0, 1)),
                        SpeedRatio = 2
                    };

                    Storyboard.SetTarget(da, label);
                    Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
                    Storyboard.SetTargetName(da, (String)label.GetValue(FrameworkElement.NameProperty));

                    storyBorad.Children.Add(da);

                }

                #endregion

                dataPoint.Storyboard = storyBorad;
#if WPF
                if (lineSeg1 != null && nextLineSeg1 != null)
                {    
                    (lineSeg2 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimation2);
                    (nextLineSeg1 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimation3);
                }
                else if (nextLineSeg1 == null && lineSeg1 != null)
                {
                    (lineSeg2 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimation2);
                }
                else
                {
                    (pathFigure as PathFigure).BeginAnimation(PathFigure.StartPointProperty, pointAnimation2);
                    (nextLineSeg1 as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimation3);
                }
   
#endif
                // Start the animation
                storyBorad.Begin();
            }

            //chart.ChartArea.ChartVisualCanvas.Background = new SolidColorBrush(Colors.Blue);
            dataSeries.Faces.Visual.Width = chart.ChartArea.ChartVisualCanvas.Width;
            dataSeries.Faces.Visual.Height = chart.ChartArea.ChartVisualCanvas.Height;

            dataSeries.Faces.LabelCanvas.Width = chart.ChartArea.ChartVisualCanvas.Width;
            dataSeries.Faces.LabelCanvas.Height = chart.ChartArea.ChartVisualCanvas.Height;

            // Update ToolTip Text
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

            if (dataSeries._movingMarker != null)
                dataSeries._movingMarker.Visibility = Visibility.Collapsed;

            chart._toolTip.Hide();

            if (dataSeries.ToolTipElement != null)
                dataSeries.ToolTipElement.Hide();

            chart.ChartArea.DisableIndicators();

            if (dataSeries.Faces != null)
            {
                RectangleGeometry clipRectangle = new RectangleGeometry();

                Double depth3d = chart.ChartArea.PLANK_DEPTH / (chart.PlotDetails.Layer3DCount == 0 ? 1 : chart.PlotDetails.Layer3DCount) * (chart.View3D ? 1 : 0);

                Double clipLeft = 0;
                Double clipTop = -depth3d - 4;
                Double clipWidth = width + depth3d;
                Double clipHeight = height + depth3d + chart.ChartArea.PLANK_THICKNESS + 10;

                AreaChart.GetClipCoordinates(chart, ref clipLeft, ref clipTop, ref clipWidth, ref clipHeight, dataSeries.PlotGroup.MinimumX, dataSeries.PlotGroup.MaximumX);

                clipRectangle.Rect = new Rect(clipLeft, clipTop, clipWidth, clipHeight);

                if (dataSeries.Faces.LabelCanvas != null && dataSeries.Faces.LabelCanvas.Parent != null)
                    (dataSeries.Faces.LabelCanvas.Parent as Canvas).Clip = clipRectangle;

                clipRectangle = new RectangleGeometry();
                clipRectangle.Rect = new Rect(0, -depth3d - 4, width + depth3d, height + chart.ChartArea.PLANK_DEPTH + chart.ChartArea.PLANK_THICKNESS + 10);

                if (dataSeries.Faces.Visual != null)
                    (dataSeries.Faces.Visual.Parent as Canvas).Clip = clipRectangle;
            }

        }
예제 #6
0
 /// <summary>
 /// 直线向目地跑动
 /// </summary>
 /// <param name="destination">目标点(游戏坐标系)</param>
 void StraightRunTo(Point destination)
 {
     if (isActionLocked) { return; }
     SetDirection(Scene.GetWindowCoordinate(Coordinate), Scene.GetWindowCoordinate(destination));
     int duration = Convert.ToInt32(Global.GetTwoPointDistance(destination, Coordinate)* Speed);
     PointAnimation animation = new PointAnimation() {
         To = destination,
         Duration = new Duration(TimeSpan.FromMilliseconds(duration)),
     };
     Storyboard.SetTarget(animation, this);
     Storyboard.SetTargetProperty(animation, new PropertyPath("Coordinate"));
     UnloadStoryboardEvent(storyboard);
     storyboard = new Storyboard();
     storyboard.Children.Add(animation);
     storyboard.Completed += new EventHandler(storyboard_Completed);
     storyboard.Begin();
     Run();
 }
예제 #7
0
        private void AnimateTo(Point point)
        {
            //TODO: Might be able to shift this stuff into the XAML
            // by using databindings for the From and To fields.
            // This would allow the style to be overridden later on.

            //NOTE: Must use PointAnimation so both hue and saturation get
            // updated at the same time. I tried using two seaprate DoubleAnimations
            // but the second one would not update the property.

            Point from = new Point(this.Theta, this.Rad);
            Point to = new Point(CalculateTheta(point), CalculateR(point));

            // The shortest path actually crosses the 360-0 discontinuity
            if (from.X - to.X > 180.0)
                to.X += 360.0;
            if (from.X - to.X < -180.0)
                to.X -= 360.0;

            Duration duration = new Duration(TimeSpan.FromSeconds(AnimationSpeed));

            sb = new Storyboard();
            sb.Duration = duration;

            var hs_animation = new PointAnimation(from, to, duration);
            hs_animation.EasingFunction = new PowerEase() { Power = AnimationEasePower };
            hs_animation.FillBehavior = FillBehavior.Stop;

            sb.Children.Add(hs_animation);
            Storyboard.SetTarget(hs_animation, this);
            Storyboard.SetTargetProperty(hs_animation, new PropertyPath(WheelSelector.HSAnimationProperty));

            sb.FillBehavior = FillBehavior.Stop;

            sb.Completed += (o, e) =>
            {
                // Set the final colour position
                this.HSAnimation = to;
            };

            // Using a storyboard like this allows us to stop it.
            sb.Begin();
        }
예제 #8
0
파일: Bubble.cs 프로젝트: Denis72/PopnTouch
        private void MovePortion(object source, EventArgs e)
        {
            Storyboard stb = new Storyboard();
            PointAnimation moveCenter = new PointAnimation();
            Random rand = new Random();
            Point p = svitem.ActualCenter;

            moveCenter.From = p;
            int vect = rand.Next(5, 10);

            /* Correction of the angle when the bubble is out limits */
            if (p.Y < 0 || p.Y > sv.Height)
            {
                angle = -angle;
                vect = 10;
            }
            else if (p.X > sv.Width || p.X < 0)
            {
                if (angle > 0)
                    angle = 180 - angle;
                else
                    angle = -180 - angle;
                vect = 10;
            }
            else
            {
                angle += rand.Next(-30, 30);
            }

            /* Correction of the angle overflow */
            if (angle > 180) { angle = -360 + angle; }
            if (angle < -180) { angle = 360 + angle; }

            /* New direction setted */

            p.X += vect * Math.Cos(angle * Math.PI / 180);
            p.Y += vect * Math.Sin(angle * Math.PI / 180);

            /* Animation */
            moveCenter.To = p;
            moveCenter.Duration = new Duration(TimeSpan.FromMilliseconds(400));
            svitem.Center = p;
            moveCenter.FillBehavior = FillBehavior.Stop;
            stb.Children.Add(moveCenter);
            Storyboard.SetTarget(moveCenter, svitem);
            Storyboard.SetTargetProperty(moveCenter, new PropertyPath(ScatterViewItem.CenterProperty));
            stb.Begin();
        }
예제 #9
0
		/// <summary>
		/// Starts animation from oldGraph to newGraph.
		/// </summary>
		/// <param name="oldGraph"></param>
		/// <param name="newGraph"></param>
		/// <param name="diff"></param>
		public void StartAnimation(PositionedGraph oldGraph, PositionedGraph newGraph, GraphDiff diff)
		{
			if (oldGraph != null)
			{
				foreach	(var oldNode in oldGraph.Nodes)
				{
					foreach	(var newNode in newGraph.Nodes)
					{
						if (oldNode.NodeVisualControl == newNode.NodeVisualControl)
						{
							ClearCanvas();
						}
					}
				}
			}
			
			this.canvas.Width = newGraph.BoundingRect.Width;
			this.canvas.Height = newGraph.BoundingRect.Height;
			
			if (oldGraph == null)
			{
				Draw(newGraph);
				return;
			}
			
			double seconds = 0.5;
			var durationMove = new Duration(TimeSpan.FromSeconds(seconds));
			var durationFade = durationMove;
			
			DoubleAnimation fadeOutAnim = new DoubleAnimation(1.0, 0.0, durationFade);
			DoubleAnimation fadeInAnim = new DoubleAnimation(0.0, 1.0, durationFade);
			
			foreach	(UIElement drawing in canvas.Children)
			{
				var arrow = drawing as Path;
				if (arrow != null)
				{
					arrow.BeginAnimation(UIElement.OpacityProperty, fadeOutAnim);
				}
			}
			
			foreach	(PositionedEdge edge in newGraph.Edges)
			{
				addEdgeToCanvas(edge).BeginAnimation(UIElement.OpacityProperty, fadeInAnim);
			}
			
			foreach	(PositionedGraphNode removedNode in diff.RemovedNodes)
			{
				removedNode.NodeVisualControl.BeginAnimation(UIElement.OpacityProperty, fadeOutAnim);
			}
			
			foreach	(PositionedGraphNode addedNode in diff.AddedNodes)
			{
				addNodeToCanvas(addedNode).BeginAnimation(UIElement.OpacityProperty, fadeInAnim);
			}
			
			bool first = true;
			foreach	(PositionedGraphNode node in diff.ChangedNodes)
			{
				var newNode = diff.GetMatchingNewNode(node);
				
				PointAnimation anim = new PointAnimation();
				if (first)
				{
					anim.Completed += new EventHandler((o, e) => { Draw(newGraph); });
					first = false;
				}
				anim.From = node.LeftTop;
				
				anim.To = newNode.LeftTop;
				anim.DecelerationRatio = 0.3;
				anim.AccelerationRatio = 0.3;
				anim.Duration = durationMove;
				node.NodeVisualControl.BeginAnimation(CanvasLocationAdapter.LocationProperty, anim);
			}
		}
예제 #10
0
 public void CenterChangedListener(object sender, EventArgs e)
 {
     handled = true;
     Helpers helpers = new Helpers();
     if (!this.isDocked && this.Center.X > win.ActualWidth - 100 && !touchDown && this.Center.Y < win.ActualHeight * .7 && !win.isTourPlayingOrAuthoring())
     {
         PointAnimation anim1 = new PointAnimation();
         anim1.Completed += anim3Completed;
         anim1.From = new Point(this.Center.X, this.Center.Y);
         anim1.To = new Point(win.ActualWidth + 1000, this.Center.Y);
         anim1.Duration = new Duration(TimeSpan.FromSeconds(.4));
         anim1.FillBehavior = FillBehavior.Stop;
         if (aldbi != null)
         {
             win._openedAssets.Remove(aldbi.scatteruri);
             aldbi.opened = false;
         }
         this.BeginAnimation(CenterProperty, anim1);
         if (_helpers.IsVideoFile(imageURIPath))
         {
             vidBub.pauseVideo();
         }
     }
 }
예제 #11
0
        void MainWindow_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            #if !old
            var origTileSize = m_targetTileSize;

            var targetTileSize = origTileSize;

            if (e.Delta > 0)
                targetTileSize *= 2;
            else
                targetTileSize /= 2;

            if (targetTileSize < 2)
                targetTileSize = 2;

            if (origTileSize == targetTileSize)
                return;

            m_targetTileSize = targetTileSize;

            var origCenter = tileControl.CenterPos;

            var p = e.GetPosition(tileControl);

            Vector v = p - new Point(tileControl.ActualWidth / 2, tileControl.ActualHeight / 2);
            v /= targetTileSize;
            v = new Vector(Math.Round(v.X), -Math.Round(v.Y));

            var ml = tileControl.ScreenPointToMapLocation(p);
            ml = new Point(Math.Round(ml.X), Math.Round(ml.Y));
            var targetCenter = ml - v;

            targetCenter = new Point(Math.Round(targetCenter.X), Math.Round(targetCenter.Y));

            var anim = new DoubleAnimation(targetTileSize, new Duration(TimeSpan.FromMilliseconds(200)));
            tileControl.BeginAnimation(TileControlD3D.TileSizeProperty, anim);

            var anim2 = new PointAnimation(targetCenter, new Duration(TimeSpan.FromMilliseconds(200)));
            if (e.Delta > 0)
                anim2.DecelerationRatio = 1.0;
            else
                anim2.AccelerationRatio = 1.0;

            tileControl.BeginAnimation(TileControlD3D.CenterPosProperty, anim2);

            Debug.Print("Anim Size {0:F2} -> {1:F2}, Center {2:F2} -> {3:F2}", origTileSize, targetTileSize, origCenter, targetCenter);

            #else
            var targetTileSize = tileControl.TileSize;

            if (e.Delta > 0)
                targetTileSize *= 2;
            else
                targetTileSize /= 2;

            if (targetTileSize < 2)
                targetTileSize = 2;

            var p = e.GetPosition(tileControl);

            Vector v = p - new Point(tileControl.ActualWidth / 2, tileControl.ActualHeight / 2);
            v /= targetTileSize;
            v = new Vector(Math.Round(v.X), -Math.Round(v.Y));

            var ml = ScreenPointToMapLocation(p);
            ml = new Point(Math.Round(ml.X), Math.Round(ml.Y));
            var targetCenter = ml - v;
            targetCenter = new Point(Math.Round(targetCenter.X), Math.Round(targetCenter.Y));

            this.CenterPos = targetCenter;
            tileControl.TileSize = targetTileSize;
            #endif
        }
예제 #12
0
        /// <summary>
        /// Moves and resizes the object.
        /// </summary>
        /// <param name="target">The target object.</param>
        /// <param name="position">Ending position.</param>
        /// <param name="width">New width.</param>
        /// <param name="height">New height.</param>
        /// <param name="milliseconds">Duration of the animation in milliseconds.</param>
        /// <param name="completed">Event handler called when animation completed.</param>
        public static void MoveAndResize(this DependencyObject target, Point position, double width, double height,
            double milliseconds, EventHandler completed = null)
        {
            Duration duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
            DoubleAnimation doubleAnimation1 = new DoubleAnimation();
            DoubleAnimation doubleAnimation2 = new DoubleAnimation();
            PointAnimation pointAnimation = new PointAnimation();

            doubleAnimation1.Duration = duration;
            doubleAnimation2.Duration = duration;
            pointAnimation.Duration = duration;

            Storyboard storyboard = new Storyboard();
            storyboard.Duration = duration;

            storyboard.Children.Add(doubleAnimation1);
            storyboard.Children.Add(doubleAnimation2);
            storyboard.Children.Add(pointAnimation);

            Storyboard.SetTarget(doubleAnimation1, target);
            Storyboard.SetTarget(doubleAnimation2, target);
            Storyboard.SetTarget(pointAnimation, target);

            Storyboard.SetTargetProperty(doubleAnimation1, new PropertyPath("(Width)"));
            Storyboard.SetTargetProperty(doubleAnimation2, new PropertyPath("(Height)"));
            Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("(Position)"));

            doubleAnimation1.To = width;
            if (!height.IsNotSet())
                doubleAnimation2.To = height;

            pointAnimation.To = position;

            if (completed != null)
                storyboard.Completed += completed;

            storyboard.Begin();
        }
예제 #13
0
        void MainWindow_KeyDown(object sender, KeyEventArgs e)
        {
            IntVector v;

            switch (e.Key)
            {
                case Key.Up: v = new IntVector(0, 1); break;
                case Key.Down: v = new IntVector(0, -1); break;
                case Key.Left: v = new IntVector(-1, 0); break;
                case Key.Right: v = new IntVector(1, 0); break;
                case Key.Add:
                    tileControl.TileSize += 1;
                    return;

                case Key.Subtract:
                    tileControl.TileSize -= 1;
                    return;

                default:
                    var diff = new IntVector(-10, -10);

                    var anim2 = new PointAnimation(tileControl.CenterPos - new Vector(diff.X, diff.Y), new Duration(TimeSpan.FromMilliseconds(2000)));
                    this.BeginAnimation(TileControlD3D.CenterPosProperty, anim2);

                    return;
            }

            //this.CenterPos += (v * 4);
            tileControl.CenterPos += new Vector(v.X, v.Y) / 10;
        }
        public void AddAnnotation(Annotation a)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                Point pos;
                if (GetPressScatterViewItemPosition(a.Press, out pos))
                {
                    PostIt postIt = new PostIt();
                    postIt.Text = a.Comment;
                    postIt.User = a.User;

                    ScatterViewItem svi = new ScatterViewItem();
                    svi.Content = postIt;
                    svi.Center = GetPostItStartPosition(a.User);
                    svi.CanScale = false;
                    svi.CanMove = true;

                    Scatter.Items.Add(svi);

                    pos.X += rand.Next(-POSTIT_VARIATION, POSTIT_VARIATION);
                    pos.Y += rand.Next(-POSTIT_VARIATION, POSTIT_VARIATION);

                    Duration duration = new Duration(TimeSpan.FromSeconds(0.5));
                    PointAnimation an = new PointAnimation();
                    an.Duration = duration;
                    an.FillBehavior = FillBehavior.Stop;
                    an.To = pos;

                    Storyboard sb = new Storyboard();
                    sb.Duration = duration;
                    sb.Children.Add(an);

                    Storyboard.SetTarget(an, svi);
                    Storyboard.SetTargetProperty(an, new PropertyPath(ScatterViewItem.CenterProperty));

                    sb.Completed += new EventHandler((s, e) =>
                    {
                        svi.Center = pos;
                    });

                    sb.Begin(Scatter);
                }
            }));
        }
        private Action<Action> AnimateItem(AnimatedMapItem item, Point from, Point to)
        {
            return completed =>
            {
                PointAnimation pointAnimation = new PointAnimation()
                {
                    Duration = TimeSpan.FromMilliseconds(300),
                    From = from,
                    To = to,
                };

                Storyboard.SetTarget(pointAnimation, item);
                Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("Point"));

                this.storyboard = new Storyboard()
                {
                    AutoReverse = false,
                };

                storyboard.Completed += this.Storyboard_Completed;
                storyboard.Children.Add(pointAnimation);
                storyboard.Begin();
            };
        }
예제 #16
0
        private void ScatterView_Drop(object sender, Microsoft.Surface.Presentation.SurfaceDragDropEventArgs e)
        {
            //Darstellen des Dokuments das in den Viewer(ScatterView) gedropped wird.
            //Leeren des Viewers
            viewer.Items.Clear();
            //Bestimmen des Pfades des darzustellenden Dokuments aus e.Cursor.Data
            FileInfo file = new FileInfo(System.IO.Path.Combine((e.Cursor.Data as InfoItem).FolderPath, (e.Cursor.Data as InfoItem).fileName));
            //Erstellt ein ScatterViewItem als Träger für das Dokument
            ScatterViewItem newItemSVI = new ScatterViewItem();
            //Überprüfen ob es sich um ein als png gerendertes pdf handelt, oder ein rtf
            if (file.Extension.Equals(".rtf"))
            {
                //Erstellen und füllen einer RichTextBox im ScatterViewItem falls rtf
                var newItem = new RichTextBox();
                newItem.Background = Brushes.Transparent;
                FileStream fs = new FileStream(System.IO.Path.Combine((e.Cursor.Data as InfoItem).FolderPath, (e.Cursor.Data as InfoItem).fileName), FileMode.Open, FileAccess.Read);
                TextRange RTBText = new TextRange(newItem.Document.ContentStart, newItem.Document.ContentEnd);
                RTBText.Load(fs, DataFormats.Rtf);
                newItem.IsHitTestVisible = false;
                newItemSVI.Content = newItem;
                newItemSVI.Background = Brushes.White;
                //newItemSVI.BeginAnimation(ScatterViewItem.HeightProperty, animY);

            }
            else
            {
                //Konvertierung des Datei-strings in ein Bild im ScatterViewItem falls png (bzw. nicht rtf)
                Image image = new Image();
                //image.Source = (new ImageSourceConverter().ConvertFromString(file.FullName)) as ImageSource;

            var bitmap = new BitmapImage();
            bitmap.BeginInit();
            bitmap.UriSource = new Uri(file.FullName);
            bitmap.CacheOption = BitmapCacheOption.OnLoad;
            bitmap.EndInit();
            image.Source = bitmap;

                newItemSVI.Content = image;
                newItemSVI.Background = Brushes.Transparent;
            }

            newItemSVI.Width = 491;
            newItemSVI.Height = 700;

            //ImageBrush imgBrush = new ImageBrush();
            //imgBrush.ImageSource = (new ImageSourceConverter().ConvertFromString("Images\\noun_project_450.png")) as ImageSource;
            //newItemSVI.Background = imgBrush;

            //Erzeugen und einblenden des ScatterViewItems das das Dokument beinhaltet, zuweisen des TouchVerhaltens
            newItemSVI.IsHitTestVisible = true;
            newItemSVI.Orientation = 0;
            newItemSVI.CanScale = false;
            newItemSVI.CanRotate = false;
            newItemSVI.CanMove = false;
            DropShadowEffect effect = new DropShadowEffect();
            effect.BlurRadius = 20;
            newItemSVI.Effect = effect;
            //newItemSVI.Center = e.Cursor.GetPosition(viewer);
            newItemSVI.Center = new Point(490, 390);
            viewer.Items.Add(newItemSVI);
            //DoubleAnimation animRot = new DoubleAnimation(0, 0, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            DoubleAnimation animX = new DoubleAnimation(156, 491, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            DoubleAnimation animY = new DoubleAnimation(200, 700, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            PointAnimation animCenter = new PointAnimation(e.Cursor.GetPosition(viewer), new Point(490, 390), new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            //DoubleAnimation animCenterY = new DoubleAnimation(e.Cursor.GetPosition(viewer).Y, 350, new Duration(TimeSpan.FromSeconds(.5)), FillBehavior.Stop);
            //newItemSVI.BeginAnimation(ScatterViewItem.OrientationProperty, animRot);
            newItemSVI.BeginAnimation(ScatterViewItem.WidthProperty, animX);
            newItemSVI.BeginAnimation(ScatterViewItem.HeightProperty, animY);
            newItemSVI.BeginAnimation(ScatterViewItem.CenterProperty, animCenter);
            infoItems.Remove((e.Cursor.Data as InfoItem));
            infoItems.Add(new InfoItem((e.Cursor.Data as InfoItem).FolderPath, (e.Cursor.Data as InfoItem).fileName, (e.Cursor.Data as InfoItem).GroupName));
            //MessageBox.Show((e.Cursor.Data as InfoItem).FolderPath+"\\"+(e.Cursor.Data as InfoItem).fileName);
            //GenerateItems();
            newItemSVI.PreviewTouchUp += new EventHandler<TouchEventArgs>(newItemSVI_PreviewTouchUp);
            newItemSVI.PreviewTouchDown += new EventHandler<TouchEventArgs>(newItemSVI_PreviewTouchDown);
        }
예제 #17
0
파일: DemoScript.cs 프로젝트: TNOCS/csTouch
        private static void AnimateWindow(FloatingElement fe,double posX, double posY, long duration=2000)
        {
// Animate to

            var pa = new PointAnimation();
            pa.From = fe.ScatterViewItem.Center;
            pa.To = new Point(posX, posY);
            pa.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
            pa.EasingFunction = new ExponentialEase() {EasingMode = EasingMode.EaseIn, Exponent = -3};
            fe.ScatterViewItem.BeginAnimation(ScatterContentControlBase.CenterProperty, pa);
            
            //fe.ScatterViewItem.BeginAnimation(ScatterContentControlBase.CenterProperty, null);
            //fe.ScatterViewItem.
            //fe.ScatterViewItem.Center = new Point(posX, posY);
        }
예제 #18
0
        public void AddtoDock(object sender, EventArgs e)
        {
            touchDown = false;

            DockableItem item = sender as DockableItem;
            Helpers helpers = new Helpers();

            if (this.Center.Y > (win.ActualHeight * .8) && !isDocked && this.Center.X > win.ActualWidth * .2 && !this.isAnimating)
            {
                // Explore mode asset management.
                win.tourExploreManageDock(item);

                this.isAnimating = true;
                this.IsHitTestVisible = false;
                this.SizeChanged -= DockableItem_SizeChanged;
                if (helpers.IsVideoFile(imageURIPath))
                {
                    vidBub.pauseVideo();
                }
                this.isAnimating = true;
                barImageHeight = bar.ActualHeight * .8;
                barImageWidth = bar.ActualHeight * this.Width / this.Height;

                dockImage = new Image();
                dockImage.Source = this.image.Source;
                dockImage.SetCurrentValue(HeightProperty, barImageHeight);
                dockImage.SetCurrentValue(WidthProperty, barImageWidth);
                wke = new WorkspaceElement();
                wke.Visibility = Visibility.Visible;
                wke.SetCurrentValue(BackgroundProperty, bar.GetValue(BackgroundProperty));
                wke = new WorkspaceElement();
                wke.Content = dockImage;
                wke.Opacity = 0;
                wke.Background = Brushes.LightGray;
                wke.bar = bar;
                wke.item = this;
                wke.artmodewin = win;
                win.DockedItems.Add(wke);
                win.DockedDockableItems.Add(this);
                bar.Items.Add(wke);

                Point startPoint = wke.TransformToAncestor(win.getMain()).Transform(new Point(0, 0));
                Point relPoint = wke.TransformToAncestor(bar).Transform(new Point(0, 0));
                rootPoint = new Point(startPoint.X + relPoint.X, startPoint.Y + relPoint.Y);

                PointAnimation anim1 = new PointAnimation();
                anim1.Completed += anim1Completed;
                anim1.From = new Point(this.Center.X, this.Center.Y);
                anim1.To = new Point(rootPoint.X + win.BarOffset + barImageWidth / 2.0, rootPoint.Y + barImageHeight / 2.0);
                anim1.Duration = new Duration(TimeSpan.FromSeconds(.4));
                anim1.FillBehavior = FillBehavior.Stop;

                isDocked = true;
                oldHeight = this.Height;
                oldWidth = this.Width;
                DoubleAnimation heightAnim = new DoubleAnimation();
                heightAnim.From = this.Height;
                heightAnim.To = barImageHeight;
                heightAnim.Duration = new Duration(TimeSpan.FromSeconds(.4));
                heightAnim.FillBehavior = FillBehavior.Stop;
                DoubleAnimation orientAnim = new DoubleAnimation();
                orientAnim.From = this.ActualOrientation;
                orientAnim.To = 0;
                orientAnim.Duration = new Duration(TimeSpan.FromSeconds(.4));
                orientAnim.FillBehavior = FillBehavior.Stop;
                DoubleAnimation widthAnim = new DoubleAnimation();
                widthAnim.From = this.Width;
                widthAnim.To = barImageWidth;// barVersion.Width;
                widthAnim.Duration = new Duration(TimeSpan.FromSeconds(.4));
                widthAnim.FillBehavior = FillBehavior.Stop;
                this.BeginAnimation(CenterProperty, anim1);
                this.BeginAnimation(MaxHeightProperty, heightAnim);
                this.BeginAnimation(MaxWidthProperty, widthAnim);
                this.BeginAnimation(OrientationProperty, orientAnim);
            }
            else if (handled == false && _description != "")
            {
                showDescription();
            }
            handled = false;
        }
예제 #19
0
        private void TurnPage(int duration)
        {
            Status = PageStatus.TurnAnimation;

            UIElement source = this as UIElement;
            CornerPoint = _cornerPoint;

            this.BeginAnimation(BookPage.CornerPointProperty, null);
            PointAnimation anim =
                new PointAnimation(
                    OriginToOppositePoint(this, origin),
                    new Duration(TimeSpan.FromMilliseconds(duration)));
            anim.AccelerationRatio = 0.6;

            anim.CurrentTimeInvalidated +=new EventHandler(anim_CurrentTimeInvalidated);
            anim.Completed += new EventHandler(anim_Completed);
            this.BeginAnimation(BookPage.CornerPointProperty, anim);
        }
예제 #20
0
        internal static void ApplyAnimationToBezierSegments(Int32 index, Storyboard storyBoard, BezierSegment bezierSegment,
            Point[] oldCtrlPoints, Point[] newCtrlPoints, PathFigure pathFigure, Point oldFirstPointOfBezierSeg, 
            Point newFirstPointOfBezierSeg)
        {
            if (index == 1)
            {
                PointAnimation pointAnimation = new PointAnimation()
                {
                    From = oldFirstPointOfBezierSeg,
                    To = newFirstPointOfBezierSeg,
                    SpeedRatio = 2,
                    Duration = new Duration(new TimeSpan(0, 0, 1))
                };

                Storyboard.SetTarget(pointAnimation, pathFigure);
                Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("StartPoint"));
                Storyboard.SetTargetName(pointAnimation, (String)pathFigure.GetValue(FrameworkElement.NameProperty));

                storyBoard.Children.Add(pointAnimation);
#if WPF
                pathFigure.BeginAnimation(PathFigure.StartPointProperty, pointAnimation);
#endif
            }

            // Animate control points
            if (oldCtrlPoints != null && newCtrlPoints != null && oldCtrlPoints.Count() == 3 && newCtrlPoints.Count() == 3)
            {
                // Loop for 3 control points
                for (int i = 0; i < 3; i++)
                {
                    // Creates PointAnimation for each control points
                    if (!oldCtrlPoints[i].Equals(newCtrlPoints[i]))
                    {
                        PointAnimation pointAnimation = new PointAnimation()
                        {
                            From = oldCtrlPoints[i],
                            To = newCtrlPoints[i],
                            SpeedRatio = 2,
                            Duration = new Duration(new TimeSpan(0, 0, 1))
                        };

                        Storyboard.SetTarget(pointAnimation, bezierSegment);
                        Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("Point" + (i + 1).ToString()));
                        Storyboard.SetTargetName(pointAnimation, (String)bezierSegment.GetValue(FrameworkElement.NameProperty));

                        storyBoard.Children.Add(pointAnimation);

#if WPF
                    switch(i)
                    {
                        case 0:
                            bezierSegment.BeginAnimation(BezierSegment.Point1Property, pointAnimation);
                            break;
                        case 1:
                            bezierSegment.BeginAnimation(BezierSegment.Point2Property, pointAnimation);
                            break;
                        case 2:
                            bezierSegment.BeginAnimation(BezierSegment.Point3Property, pointAnimation);
                            break;
                    }
#endif
                    }
                }
            }

        }
예제 #21
0
        /// <summary>
        /// Setup the animation for the point
        /// </summary>
        /// <param name="element">Element to run the animation on</param>
        /// <param name="prop">Property to run the animation on</param>
        /// <param name="from">starting point</param>
        /// <param name="to">destination point</param>
        /// <param name="acceleration">acceleration rate</param>
        /// <param name="deceleration">deceleration rate</param>
        /// <param name="durationMS">duration of the animation in milliseconds</param>
        /// <param name="callbackFunc">callback function</param>
        public static AnimationClock AnimatePointEasingEquation(
            DependencyObject element,
            DependencyProperty prop,
            Point? from,
            Point to,
            int durationMS,
            double? acceleration,
            double? deceleration,
            EventHandler callbackFunc)
        {
            Point defaultFrom = element.GetValue(prop) == null ?
                                 new Point(0, 0) :
                                 (Point)element.GetValue(prop);

            PointAnimation anim = new PointAnimation();
            anim.From = from.GetValueOrDefault(defaultFrom);
            anim.To = to;

            return Animate(element, prop, anim, durationMS, null, null, callbackFunc);
        }
예제 #22
0
        /// <summary>
        /// 从一点向另一点移动
        /// </summary>
        /// <param name="from">起点</param>
        /// <param name="to">终点</param>
        /// <param name="speed">速度系数</param>
        /// <param name="moveMode">模式</param>
        public virtual void Move(Point from, Point to, double speed, MoveModes moveMode)
        {
            Duration duration = new Duration(TimeSpan.FromMilliseconds(Global.GetTwoPointDistance(from, to) * speed));
            Storyboard storyboard = new Storyboard();
            PointAnimation pointAnimation = new PointAnimation() {
                From = from,
                To = to,
                Duration = duration,
            };
            Storyboard.SetTarget(pointAnimation, this);
            Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("Coordinate"));
            storyboard.Children.Add(pointAnimation);
            switch (moveMode) {
                case MoveModes.Normal:

                    break;
                case MoveModes.Opacity:
                    DoubleAnimation doubleAnimation = new DoubleAnimation() {
                        From = 1,
                        To = 0,
                        Duration = duration,
                    };
                    Storyboard.SetTarget(doubleAnimation, this);
                    Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("Opacity"));
                    storyboard.Children.Add(doubleAnimation);
                    break;
            }
            EventHandler handler = null;
            storyboard.Completed += handler = (s, e) => {
                storyboard.Completed -= handler;
                storyboard.Stop();
                storyboard = null;
                Dispose();
                if (MoveCompleted != null) { MoveCompleted(this, e); }
            };
            storyboard.Begin();
        }
예제 #23
0
        private void AnimateZoom(double dest, Point? zoomCenter)
        {
            if (dest < slZoom.Minimum)
                dest = slZoom.Minimum;

            if (dest > slZoom.Maximum)
                dest = slZoom.Maximum;

            PointAnimation pa = null;
            
            if (zoomCenter.HasValue) 
            {
                gateCanvas.SetZoomCenter();
                pa = new PointAnimation(gateCanvas.ZoomCenter, zoomCenter.Value, new Duration(new TimeSpan(0, 0, 1)));
                
                pa.AccelerationRatio = 0.2;
                pa.DecelerationRatio = 0.2;

            }
            DoubleAnimation da = new DoubleAnimation(dest, new Duration(new TimeSpan(0, 0, 1)));
            da.AccelerationRatio = 0.2;
            da.DecelerationRatio = 0.2;

            Storyboard sb = new Storyboard();
            sb.Children.Add(da);
            if (pa != null)
            {
                sb.Children.Add(pa);
                Storyboard.SetTarget(pa, gateCanvas);
                Storyboard.SetTargetProperty(pa, new PropertyPath(GateCanvas.ZoomCenterProperty));
                gateCanvas.UseZoomCenter = true;

            }
            Storyboard.SetTarget(da, slZoom);
            Storyboard.SetTargetProperty(da, new PropertyPath(Slider.ValueProperty));
            sb.FillBehavior = FillBehavior.Stop;

            
            sb.Begin();

            BackgroundWorker finishani = new BackgroundWorker();
            finishani.DoWork += (sender2, e2) =>
            {
                System.Threading.Thread.Sleep(900);
            };
            finishani.RunWorkerCompleted += (sender2, e2) =>
            {
                if (zoomCenter.HasValue)
                    gateCanvas.ZoomCenter = zoomCenter.Value;

                slZoom.Value = dest;
            };
            finishani.RunWorkerAsync();

            
        }
예제 #24
0
 /// <summary>
 /// 创建UI的Storyboard动画的子对象PointAnimation
 /// </summary>
 public static PointAnimation CreatePointAnimation(DependencyObject d, string propertyName, Point to, Duration duration, IEasingFunction easingFunction)
 {
     PointAnimation pointAnimation = new PointAnimation() {
         To = to,
         Duration = duration,
         EasingFunction = easingFunction
     };
     Storyboard.SetTarget(pointAnimation, d);
     Storyboard.SetTargetProperty(pointAnimation, new PropertyPath(propertyName));
     return pointAnimation;
 }
예제 #25
0
        public void compactIn()
        {
            animated = false;
            int count = 0;
            foreach (ScatterViewItem i in _svis)
            {
                PointAnimation anim1 = new PointAnimation();
                anim1.From = new Point(i.Center.X, i.Center.Y);

                anim1.To = _pointList[count];
                anim1.Duration = new Duration(TimeSpan.FromSeconds(.4));
                anim1.FillBehavior = FillBehavior.Stop;
                anim1.Completed +=new EventHandler(anim1_Completed);

                i.BeginAnimation(ScatterContentControlBase.CenterProperty, anim1);
                animationOn = true;
                count++;
            }
            _pointList.Clear();
        }
예제 #26
0
		/// <summary>
		/// Starts animation from oldGraph to newGraph.
		/// </summary>
		/// <param name="oldGraph"></param>
		/// <param name="newGraph"></param>
		/// <param name="diff"></param>
		public void StartAnimation(PositionedGraph oldGraph, PositionedGraph newGraph, GraphDiff diff)
		{
			// account for that the visual controls could have been reused (we are not reusing controls now - NodeControlCache does nothing)
			
			this.canvas.Width = newGraph.BoundingRect.Width;
			this.canvas.Height = newGraph.BoundingRect.Height;
			
			if (oldGraph == null) {
				Draw(newGraph);
				return;
			}
			
			var durationMove = new Duration(TimeSpan.FromSeconds(animationDurationSeconds));
			var durationFade = durationMove;
			
			DoubleAnimation fadeOutAnim = new DoubleAnimation(1.0, 0.0, durationFade);
			DoubleAnimation fadeInAnim = new DoubleAnimation(0.0, 1.0, durationFade);
			
			foreach	(UIElement drawing in canvas.Children) {
				var arrow = drawing as Path;
				if (arrow != null) {
					arrow.BeginAnimation(UIElement.OpacityProperty, fadeOutAnim);
				}
			}
			
			foreach	(PositionedEdge edge in newGraph.Edges) {
				AddEdgeToCanvas(edge).BeginAnimation(UIElement.OpacityProperty, fadeInAnim);
			}
			
			foreach	(PositionedNode removedNode in diff.RemovedNodes) {
				removedNode.NodeVisualControl.BeginAnimation(UIElement.OpacityProperty, fadeOutAnim);
			}
			
			foreach	(PositionedNode addedNode in diff.AddedNodes) {
				AddNodeToCanvas(addedNode).BeginAnimation(UIElement.OpacityProperty, fadeInAnim);
			}
			
			bool first = true;
			foreach	(PositionedNode node in diff.ChangedNodes) {
				var newNode = diff.GetMatchingNewNode(node);
				
				PointAnimation anim = new PointAnimation();
				if (first) {
					anim.Completed += (o, e) => {
						Draw(newGraph);
						if (oldGraph != null) {
							foreach (var oldNode in oldGraph.Nodes) {
								oldNode.ReleaseNodeVisualControl();
							}
						}
					};
					first = false;
				}
				anim.From = node.LeftTop;
				
				anim.To = newNode.LeftTop;
				anim.DecelerationRatio = 0.3;
				anim.AccelerationRatio = 0.3;
				anim.Duration = durationMove;
				node.NodeVisualControl.BeginAnimation(CanvasLocationAdapter.LocationProperty, anim);
			}
		}
예제 #27
0
        public void spreadEven(List<ScatterViewItem> sv1, List<ScatterViewItem> sv2, Point startSv1, Point startSv2 )
        {
            Point current = _center;
            double x = startSv1.X;
            double y = startSv1.Y;

            if (y == 0)
            {
                y = Math.Max(sv2[0].Width, sv2[0].Height);
            }

            foreach (ScatterViewItem i in sv1)
            {
                Point dest = new Point(); ;
                if (groupNo == 0)
                    dest = new Point(current.X /*+ x + i.Width/2*/, current.Y + y + i.Height / 2);
                else if (groupNo == 1)
                    dest = new Point(current.X /*+ x + i.Width/2*/, current.Y + y + i.Height / 2);
                else if (groupNo == 2)
                    dest = new Point(current.X /*+ x + i.Width/2*/, current.Y - y - i.Height / 2);
                else
                    dest = new Point(current.X /*+ x + i.Width/2*/, current.Y - y - i.Height / 2);

                x = Math.Max(i.Width / 2, i.Height / 2);
                y = Math.Max(i.Width / 2, i.Height / 2);
                current = dest;

                PointAnimation anim1 = new PointAnimation();
                anim1.From = new Point(i.Center.X, i.Center.Y);
                anim1.To = dest;
                anim1.Duration = new Duration(TimeSpan.FromSeconds(.4));
                anim1.Completed += new EventHandler(anim1_Completed);

                i.BeginAnimation(ScatterContentControlBase.CenterProperty, anim1);
                animationOn = true;
            }

            current = _center;
            x = startSv2.X;
            y = startSv2.Y;

            if (x == 0)
            {
                x = Math.Max(sv1[0].Width, sv1[0].Height);
            }

            foreach (ScatterViewItem i in sv2)
            {
                Point dest = new Point(); ;
                if(groupNo == 0)
                    dest = new Point(current.X + x + i.Width / 2, current.Y /*+ y - i.Height / 2*/);
                else if(groupNo == 1)
                    dest = new Point(current.X - x - i.Width / 3, current.Y /*+ y - i.Height / 2*/);
                else if(groupNo == 2)
                    dest = new Point(current.X - x - i.Width / 2, current.Y /*+ y - i.Height / 2*/);
                else
                    dest = new Point(current.X + x + i.Width / 2, current.Y /*+ y - i.Height / 2*/);

                x = Math.Max(i.Width / 2, i.Height / 2);
                y = -Math.Max(i.Width / 2, i.Height / 2);
                current = dest;

                PointAnimation anim1 = new PointAnimation();
                anim1.From = new Point(i.Center.X, i.Center.Y);
                anim1.To = dest;
                anim1.Duration = new Duration(TimeSpan.FromSeconds(.4));
                anim1.Completed += new EventHandler(anim1_Completed);

                i.BeginAnimation(ScatterContentControlBase.CenterProperty, anim1);
                animationOn = true;
            }
        }
예제 #28
0
 /// <summary>
 /// 向目的地传送
 /// </summary>
 /// <param name="destination">目的地坐标</param>
 /// <param name="Direction">新朝向</param>
 public void TeleportTo(Point destination, Directions Direction)
 {
     this.Direction = Direction;
     PointAnimation animation = new PointAnimation() {
         To = destination,
         Duration = new Duration(TimeSpan.Zero),
     };
     Storyboard.SetTarget(animation, this);
     Storyboard.SetTargetProperty(animation, new PropertyPath("Coordinate"));
     UnloadStoryboardEvent(storyboard);
     storyboard = new Storyboard();
     storyboard.Children.Add(animation);
     storyboard.Completed += new EventHandler(Teleport_Completed);
     storyboard.Begin();
     Stand();
 }
예제 #29
0
    /// <summary>
    /// This basically just sets the value of <see cref="Northwoods.GoXam.Node.Position"/>,
    /// but with animated movement.
    /// </summary>
    /// <param name="node"></param>
    /// <param name="newpos">a new position in model coordinates</param>
    /// <remarks>
    /// There is no animation if <see cref="Animated"/> is false,
    /// if the <see cref="AnimationTime"/> is very small, or
    /// if the original position and the new position are very near to each other
    /// or offscreen.
    /// </remarks>
    public void MoveAnimated(Node node, Point newpos) {
      if (node == null) return;
      VerifyAccess();
      Point oldloc = node.Location;
      Rect oldb = node.Bounds;

      //Diagram.Debug("LayoutManager.MoveAnimated: " + Diagram.Str(node) + "  " + Diagram.Str(node.Position) + " -- > " + Diagram.Str(newpos));
      // always move the node
      node.Position = newpos;
      if (this.Story != null) {
        // if MoveAnimated is called more than once for a Node, remove any previous saved animation
        PointAnimation anim = null;
        if (this.Animations.TryGetValue(node, out anim)) {
          //Diagram.Debug("  removed animation for " + node.ToString());
          this.Story.Children.Remove(anim);
        }
      }

      // try not to bother with animations that won't be visibly useful
      if (!this.Animated) return;
      if (this.AnimationTime <= 10) return;
      // two pixels or more (but that's in model coordinates)
      if (Math.Abs(newpos.X-oldb.X) < 2 && Math.Abs(newpos.Y-oldb.Y) < 2) return;
      FrameworkElement elt = node.VisualElement;
      if (elt == null) return;

      // only do animation for nodes whose new or old bounds are visible in the view
      //?? this doesn't work reliably:
      Diagram diagram = this.Diagram;
      if (diagram == null || diagram.Panel == null) return;
      Rect nearRect = diagram.Panel.InflatedViewportBounds;
      Rect newb = new Rect(newpos.X, newpos.Y, oldb.Width, oldb.Height);
      if (!Geo.Intersects(nearRect, oldb) && !Geo.Intersects(nearRect, newb)) return;

      // start an animation
      //Diagram.Debug("  MoveAnimated " + Diagram.Str(new Point(oldb.X, oldb.Y)) + Diagram.Str(node.Position));
      if (Double.IsNaN(oldloc.X)) oldloc.X = this.DefaultLocation.X;
      if (Double.IsNaN(oldloc.Y)) oldloc.Y = this.DefaultLocation.Y;
      PointAnimation a = new PointAnimation();
      a.From = oldloc;
      a.Duration = this.AnimationDuration;

      Storyboard.SetTarget(a, elt);
      Storyboard.SetTargetProperty(a, new PropertyPath(Node.LocationProperty));
      Storyboard story = this.Story;
      if (story == null) {  // when called from outside of DoLayoutDiagram
        Storyboard singlestory = new Storyboard();
        singlestory.Children.Add(a);
        StartStoryboard(singlestory);
      } else {
        StartingLayoutAnimation();
        story.Children.Add(a);  // collect animations for later action, all at once
        this.Animations[node] = a;
      }
    }
예제 #30
0
 /// <summary>
 /// 被弹开
 /// </summary>
 /// <param name="center">中心</param>
 /// <param name="distance">距离</param>
 /// <param name="duration">持续时间(单位毫秒)</param>
 public void BeBounce(Point center, int distance, int duration)
 {
     Point p0 = Scene.GetWindowCoordinate(center);
     Point p1 = Scene.GetWindowCoordinate(Coordinate);
     double m = Global.GetTwoPointDistance(p0, p1);
     double n = distance;
     double x = ((p1.X - p0.X) * (m + n) / m) + p0.X;
     double y = ((p1.Y - p0.Y) * (m + n) / m) + p0.Y;
     Point p2 = Scene.GetGameCoordinate(new Point(x, y));
     if (p2.X < 0) { p2.X = 0; }
     if (p2.Y < 0) { p2.Y = 0; }
     if (p2.X > Scene.TerrainMatrix.GetUpperBound(0)) { p2.X = Scene.TerrainMatrix.GetUpperBound(0); }
     if (p2.Y > Scene.TerrainMatrix.GetUpperBound(0)) { p2.Y = Scene.TerrainMatrix.GetUpperBound(0); }
     isActionLocked = true;
     Injure();
     PointAnimation animation = new PointAnimation() {
         To = p2,
         Duration = new Duration(TimeSpan.FromMilliseconds(duration)),
     };
     animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
     Storyboard.SetTarget(animation, this);
     Storyboard.SetTargetProperty(animation, new PropertyPath("Coordinate"));
     UnloadStoryboardEvent(storyboard);
     storyboard = new Storyboard();
     storyboard.Children.Add(animation);
     storyboard.Completed += new EventHandler(BePushed_Completed);
     storyboard.Begin();
 }
예제 #31
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ColorIllusions2;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot                = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.lbMainTitle               = ((System.Windows.Controls.TextBlock)(this.FindName("lbMainTitle")));
     this.Stimulus                  = ((System.Windows.Controls.ListBox)(this.FindName("Stimulus")));
     this.spCenterSpeed             = ((System.Windows.Controls.StackPanel)(this.FindName("spCenterSpeed")));
     this.nudCenterSpeed            = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudCenterSpeed")));
     this.spFrequency               = ((System.Windows.Controls.StackPanel)(this.FindName("spFrequency")));
     this.nudCenterScalingFrequency = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudCenterScalingFrequency")));
     this.spShearing                = ((System.Windows.Controls.StackPanel)(this.FindName("spShearing")));
     this.nudShearingFactor         = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudShearingFactor")));
     this.nudShearingAngle          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudShearingAngle")));
     this.nudShearingFreq           = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudShearingFreq")));
     this.spStatShearDot            = ((System.Windows.Controls.StackPanel)(this.FindName("spStatShearDot")));
     this.cbStatWheel               = ((System.Windows.Controls.CheckBox)(this.FindName("cbStatWheel")));
     this.cbStatDot                 = ((System.Windows.Controls.CheckBox)(this.FindName("cbStatDot")));
     this.nudZoom                 = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudZoom")));
     this.nudWheelFromRed         = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelFromRed")));
     this.nudWheelFromGreen       = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelFromGreen")));
     this.nudWheelFromBlue        = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelFromBlue")));
     this.nudWheelToRed           = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelToRed")));
     this.nudWheelToGreen         = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelToGreen")));
     this.nudWheelToBlue          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudWheelToBlue")));
     this.nudMaskRed              = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskRed")));
     this.nudMaskGreen            = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskGreen")));
     this.nudMaskBlue             = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskBlue")));
     this.cbMarker                = ((System.Windows.Controls.CheckBox)(this.FindName("cbMarker")));
     this.spRingCB                = ((System.Windows.Controls.StackPanel)(this.FindName("spRingCB")));
     this.cbRings                 = ((System.Windows.Controls.CheckBox)(this.FindName("cbRings")));
     this.spMarkerSpeed           = ((System.Windows.Controls.StackPanel)(this.FindName("spMarkerSpeed")));
     this.nudMarkerSpeed          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMarkerSpeed")));
     this.TextureMap              = ((System.Windows.Controls.ListBox)(this.FindName("TextureMap")));
     this.spMaskRotation          = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskRotation")));
     this.nudMaskRotationSpeed    = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskRotationSpeed")));
     this.spMaskSize              = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskSize")));
     this.nudMaskSize             = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskSize")));
     this.spTextureScale          = ((System.Windows.Controls.StackPanel)(this.FindName("spTextureScale")));
     this.nudMaskScale            = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskScale")));
     this.spMaskScaling           = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskScaling")));
     this.nudMaskScalingFrequency = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskScalingFrequency")));
     this.spMaskOffset            = ((System.Windows.Controls.StackPanel)(this.FindName("spMaskOffset")));
     this.nudMaskXOffset          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskXOffset")));
     this.nudMaskYOffset          = ((System.Windows.Controls.NumericUpDown)(this.FindName("nudMaskYOffset")));
     this.spFlicker               = ((System.Windows.Controls.StackPanel)(this.FindName("spFlicker")));
     this.cbFlicker               = ((System.Windows.Controls.CheckBox)(this.FindName("cbFlicker")));
     this.IllusionPanel           = ((System.Windows.Controls.Canvas)(this.FindName("IllusionPanel")));
     this.IllusionClip            = ((System.Windows.Media.RectangleGeometry)(this.FindName("IllusionClip")));
     this.canvasSpokewheel        = ((System.Windows.Controls.Canvas)(this.FindName("canvasSpokewheel")));
     this.MotionGenerator         = ((System.Windows.Media.Animation.Storyboard)(this.FindName("MotionGenerator")));
     this.aniMaskRot              = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMaskRot")));
     this.aniWheelRot             = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniWheelRot")));
     this.aniWheelScale           = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniWheelScale")));
     this.aniMaskScale            = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMaskScale")));
     this.aniMarkerRot            = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMarkerRot")));
     this.aniMarkerScale          = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMarkerScale")));
     this.aniMarker2Scale         = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("aniMarker2Scale")));
     this.aniFlicker              = ((System.Windows.Media.Animation.PointAnimation)(this.FindName("aniFlicker")));
     this.imgSectors              = ((System.Windows.Controls.Image)(this.FindName("imgSectors")));
     this.imgRHSpirals            = ((System.Windows.Controls.Image)(this.FindName("imgRHSpirals")));
     this.imgLHSpirals            = ((System.Windows.Controls.Image)(this.FindName("imgLHSpirals")));
     this.imgRings                = ((System.Windows.Controls.Image)(this.FindName("imgRings")));
     this.imgWheel4               = ((System.Windows.Controls.Image)(this.FindName("imgWheel4")));
     this.imgWheel8               = ((System.Windows.Controls.Image)(this.FindName("imgWheel8")));
     this.imgWheel16              = ((System.Windows.Controls.Image)(this.FindName("imgWheel16")));
     this.imgVSinus128            = ((System.Windows.Controls.Image)(this.FindName("imgVSinus128")));
     this.imgVSinus256            = ((System.Windows.Controls.Image)(this.FindName("imgVSinus256")));
     this.imgHSinus128            = ((System.Windows.Controls.Image)(this.FindName("imgHSinus128")));
     this.imgHSinus256            = ((System.Windows.Controls.Image)(this.FindName("imgHSinus256")));
     this.imgSteppedSectors       = ((System.Windows.Controls.Image)(this.FindName("imgSteppedSectors")));
     this.borderDepthMarker2      = ((System.Windows.Controls.Border)(this.FindName("borderDepthMarker2")));
     this.borderDepthMarker       = ((System.Windows.Controls.Border)(this.FindName("borderDepthMarker")));
     this.borderCnvMask           = ((System.Windows.Controls.Border)(this.FindName("borderCnvMask")));
     this.cnvMask                 = ((System.Windows.Controls.Canvas)(this.FindName("cnvMask")));
     this.imgRdDots1              = ((System.Windows.Controls.Image)(this.FindName("imgRdDots1")));
     this.imgRDRings              = ((System.Windows.Controls.Image)(this.FindName("imgRDRings")));
     this.imgNoDots               = ((System.Windows.Controls.Image)(this.FindName("imgNoDots")));
     this.imgHalfRdDots           = ((System.Windows.Controls.Image)(this.FindName("imgHalfRdDots")));
     this.imgRDSpirals            = ((System.Windows.Controls.Image)(this.FindName("imgRDSpirals")));
     this.imgTiltedLines90        = ((System.Windows.Controls.Image)(this.FindName("imgTiltedLines90")));
     this.imgTiltedLines45        = ((System.Windows.Controls.Image)(this.FindName("imgTiltedLines45")));
     this.imgTiltedLines0         = ((System.Windows.Controls.Image)(this.FindName("imgTiltedLines0")));
     this.MaskScale               = ((System.Windows.Media.ScaleTransform)(this.FindName("MaskScale")));
     this.MaskRotPS               = ((Shader.Effects.MakeRotationEffect)(this.FindName("MaskRotPS")));
     this.CenterPS                = ((Shader.Effects.ColorFromMapEffect)(this.FindName("CenterPS")));
     this.MarkerPS                = ((Shader.Effects.MakeDepthMarkerEffect)(this.FindName("MarkerPS")));
     this.Marker2PS               = ((Shader.Effects.MakeDepthMarker2Effect)(this.FindName("Marker2PS")));
     this.Nabel  = ((System.Windows.Shapes.Ellipse)(this.FindName("Nabel")));
     this.wNabel = ((System.Windows.Shapes.Ellipse)(this.FindName("wNabel")));
 }