/// <summary> /// Initialise class. /// </summary> private void Init() { /// cache references to rentangle classes. rectangle1Class = rectangle1.GetComponent <AnimationRectangle>(); rectangle2Class = rectangle2.GetComponent <AnimationRectangle>(); // start animation controller coroutine. StartCoroutine(AnimationController()); }
public MainWindow() { mainWindow = this; InitializeComponent(); Load(); SetPage(CurrentPage.Daily); MyFrame.Content = Pages[0]; AnimationRectangle.BeginAnimation(OpacityProperty, new DoubleAnimation(1, 0, new Duration(TimeSpan.FromMilliseconds(1400)))); RefreshTimer(); }
private void VarItemPositionX_VariableUpdated(object sender, object newVariable) { if (_selectedFrameItem != null) { Type FrameType = (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame.GetType(); if (FrameType == typeof(AnimationRectangle) || FrameType == typeof(AnimationFilledRectangle)) { AnimationRectangle frame = ((_selectedFrameItem as Control_AnimationFrameItem).ContextFrame as AnimationRectangle); (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame = frame.SetDimension(new System.Drawing.RectangleF((float)newVariable, frame.Dimension.Y, frame.Dimension.Width, frame.Dimension.Height)); } else { (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame = (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame.SetDimension(new System.Drawing.RectangleF((float)newVariable, (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame.Dimension.Y, (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame.Dimension.Width, (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame.Dimension.Height)); } } }
private void animMixer_AnimationFrameItemSelected(object sender, AnimationFrame frame) { //Deselect old frame if (_selectedFrameItem != null && _selectedFrameItem is Control_AnimationFrameItem) { (_selectedFrameItem as Control_AnimationFrameItem).SetSelected(false); } _selectedFrameItem = (Control_AnimationFrameItem)sender; (_selectedFrameItem as Control_AnimationFrameItem).SetSelected(true); StackPanel newPanel = new StackPanel(); bool _skipExtra = false; double separatorHeight = 3; //Add default options if (frame is AnimationCircle) { AnimationCircle _frameCircle = (frame as AnimationCircle); Control_VariableItem varItemColor = new Control_VariableItem() { VariableTitle = "Color", VariableObject = _frameCircle.Color }; varItemColor.VariableUpdated += VarItemColor_VariableUpdated; Control_VariableItem varItemWidth = new Control_VariableItem() { VariableTitle = "Width", VariableObject = _frameCircle.Width }; varItemWidth.VariableUpdated += VarItemWidth_VariableUpdated; Control_VariableItem varItemCenterX = new Control_VariableItem() { VariableTitle = "Center X", VariableObject = _frameCircle.Center.X }; varItemCenterX.VariableUpdated += VarItemCenterX_VariableUpdated; Control_VariableItem varItemCenterY = new Control_VariableItem() { VariableTitle = "Center Y", VariableObject = _frameCircle.Center.Y }; varItemCenterY.VariableUpdated += VarItemCenterY_VariableUpdated; Control_VariableItem varItemDimensionRadius = new Control_VariableItem() { VariableTitle = "Radius", VariableObject = _frameCircle.Radius }; varItemDimensionRadius.VariableUpdated += VarItemDimensionRadius_VariableUpdated; newPanel.Children.Add(varItemColor); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); if (!(frame is AnimationFilledCircle)) { newPanel.Children.Add(varItemWidth); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); } newPanel.Children.Add(varItemCenterX); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemCenterY); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemDimensionRadius); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); } else if (frame is AnimationRectangle) { AnimationRectangle _frameRectangle = (frame as AnimationRectangle); Control_VariableItem varItemColor = new Control_VariableItem() { VariableTitle = "Color", VariableObject = _frameRectangle.Color }; varItemColor.VariableUpdated += VarItemColor_VariableUpdated; Control_VariableItem varItemWidth = new Control_VariableItem() { VariableTitle = "Width", VariableObject = _frameRectangle.Width }; varItemWidth.VariableUpdated += VarItemWidth_VariableUpdated; Control_VariableItem varItemPositionX = new Control_VariableItem() { VariableTitle = "Position X", VariableObject = _frameRectangle.Dimension.X }; varItemPositionX.VariableUpdated += VarItemPositionX_VariableUpdated; Control_VariableItem varItemPositionY = new Control_VariableItem() { VariableTitle = "Position Y", VariableObject = _frameRectangle.Dimension.Y }; varItemPositionY.VariableUpdated += VarItemPositionY_VariableUpdated; Control_VariableItem varItemDimensionWidth = new Control_VariableItem() { VariableTitle = "Width", VariableObject = _frameRectangle.Dimension.Width }; varItemDimensionWidth.VariableUpdated += VarItemDimensionWidth_VariableUpdated; Control_VariableItem varItemDimensionHeight = new Control_VariableItem() { VariableTitle = "Height", VariableObject = _frameRectangle.Dimension.Height }; varItemDimensionHeight.VariableUpdated += VarItemDimensionHeight_VariableUpdated; newPanel.Children.Add(varItemColor); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); if (!(frame is AnimationFilledRectangle)) { newPanel.Children.Add(varItemWidth); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); } newPanel.Children.Add(varItemPositionX); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemPositionY); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemDimensionWidth); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemDimensionHeight); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); } else if (frame is AnimationLine) { AnimationLine _frameLine = (frame as AnimationLine); Control_VariableItem varItemColor = new Control_VariableItem() { VariableTitle = "Start Color", VariableObject = _frameLine.Color }; varItemColor.VariableUpdated += VarItemColor_VariableUpdated; Control_VariableItem varItemEndColor = new Control_VariableItem() { VariableTitle = "End Color", VariableObject = _frameLine.EndColor }; varItemEndColor.VariableUpdated += VarItemEndColor_VariableUpdated; Control_VariableItem varItemWidth = new Control_VariableItem() { VariableTitle = "Width", VariableObject = _frameLine.Width }; varItemWidth.VariableUpdated += VarItemWidth_VariableUpdated; Control_VariableItem varItemStartPositionX = new Control_VariableItem() { VariableTitle = "Start Position X", VariableObject = _frameLine.StartPoint.X }; varItemStartPositionX.VariableUpdated += VarItemStartPositionX_VariableUpdated; varItemWidth.VariableUpdated += VarItemWidth_VariableUpdated; Control_VariableItem varItemStartPositionY = new Control_VariableItem() { VariableTitle = "Start Position Y", VariableObject = _frameLine.StartPoint.Y }; varItemStartPositionY.VariableUpdated += VarItemStartPositionY_VariableUpdated; Control_VariableItem varItemEndPositionX = new Control_VariableItem() { VariableTitle = "End Position X", VariableObject = _frameLine.EndPoint.X }; varItemEndPositionX.VariableUpdated += VarItemEndPositionX_VariableUpdated; varItemWidth.VariableUpdated += VarItemWidth_VariableUpdated; Control_VariableItem varItemEndPositionY = new Control_VariableItem() { VariableTitle = "End Position Y", VariableObject = _frameLine.EndPoint.Y }; varItemEndPositionY.VariableUpdated += VarItemEndPositionY_VariableUpdated; newPanel.Children.Add(varItemColor); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemEndColor); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemWidth); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemStartPositionX); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemStartPositionY); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemEndPositionX); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(varItemEndPositionY); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); } else if (frame is AnimationManualColorFrame) { _skipExtra = true; Control_VariableItem VarItemPrimaryManualColor = new Control_VariableItem() { VariableTitle = "Primary Color", VariableObject = _PrimaryManualColor }; VarItemPrimaryManualColor.VariableUpdated += VarItemPrimaryManualColor_VariableUpdated; Control_VariableItem VarItemSecondaryManualColor = new Control_VariableItem() { VariableTitle = "Secondary Color", VariableObject = _SecondaryManualColor }; VarItemSecondaryManualColor.VariableUpdated += VarItemSecondaryManualColor_VariableUpdated; Button btnClearColors = new Button() { Content = "Clear Frame Colors", HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; btnClearColors.Click += BtnClearColors_Click; //Color picker newPanel.Children.Add(VarItemPrimaryManualColor); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(VarItemSecondaryManualColor); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); newPanel.Children.Add(btnClearColors); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); } if (!_skipExtra) { Control_VariableItem varItemAngle = new Control_VariableItem() { VariableTitle = "Angle", VariableObject = frame.Angle }; varItemAngle.VariableUpdated += VarItemAngle_VariableUpdated;; newPanel.Children.Add(varItemAngle); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); } Control_VariableItem varItemTransitionType = new Control_VariableItem() { VariableTitle = "Transition Type", VariableObject = frame.TransitionType }; varItemTransitionType.VariableUpdated += VarItemTransitionType_VariableUpdated; newPanel.Children.Add(varItemTransitionType); newPanel.Children.Add(new Separator() { Height = separatorHeight, Opacity = 0 }); Button btnRemoveFrame = new Button() { Content = "Remove Frame", HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch }; btnRemoveFrame.Click += BtnRemoveFrame_Click; newPanel.Children.Add(btnRemoveFrame); grpbxProperties.Content = newPanel; }
private void PlayAnimation() => AnimationRectangle.BeginAnimation(OpacityProperty, Animation);