Я создаю игру Lingo от телевидения (Голландия). Остались лишь последние детали — анимация. Шары состоят из сетки, границы, метки и двух полигонов сверху и снизу. Фон и «Желтое наложение» заполнены градиентом. Теперь это просто простая анимация скрытия и отображения границы. Но это не игриво...
Могу ли я получить помощь, чтобы добиться этого? Я подумал, что-нибудь вроде анимации остановки и одновременного ее поворота? Заранее спасибо за примеры
Текущая анимация
RadialGradientBrush ball = new RadialGradientBrush
{
GradientOrigin = new Point(0.6, 0.2)
};
GradientStop stop1 = new GradientStop(Colors.Blue, 0.0);
GradientStop stop2 = new GradientStop(Colors.DarkBlue, 0.8);
ball.GradientStops.Add(stop1);
ball.GradientStops.Add(stop2);
Overlay.Background = Blue_ball;
await Task.Delay(100);
SoundPlayer Ball_remove = new SoundPlayer { Stream = Properties.Resources.Ball_remove };
Ball_remove.Play();
DoubleAnimation ca = new DoubleAnimation()
{
From = 1.0,
To = 0.0,
Duration = new Duration(TimeSpan.FromMilliseconds(75)),
RepeatBehavior = new RepeatBehavior(3.0),
AutoReverse = true
};
Storyboard.SetTarget(ca, Overlay);
Storyboard.SetTargetProperty(ca, new PropertyPath("Opacity"));
Storyboard sb = new Storyboard();
sb.Children.Add(ca);
sb.Begin();
Градиентная заливка мяча
Код для мяча
Grid Ball_base = new Grid()
{
Background = new SolidColorBrush(Colors.Transparent),
Width = 118,
Height = 118,
};
Border Ball_border = new Border
{
BorderThickness = new Thickness(5),
BorderBrush = new SolidColorBrush(Colors.Transparent),
Background = Blue_ball,
CornerRadius = new CornerRadius(100),
Width = 118,
Height = 118
};
Label Ball_label = new Label
{
Height = 118,
FontFamily = new FontFamily("Microsoft Sans Serif"),
Content = 99,
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
Margin = new Thickness(0, 0, 0, 0),
FontSize = 120,
Foreground = new SolidColorBrush(Colors.White),
Background = null,
};
Polygon Up = new Polygon
{
Fill = new SolidColorBrush(Colors.Transparent),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(10),
};
Polygon Down = new Polygon
{
Fill = new SolidColorBrush(Colors.Transparent),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Bottom,
Margin = new Thickness(10),
};
Point Point1 = new Point(0, 0);
Point Point2 = new Point(30, 00);
Point Point3 = new Point(15, 15);
PointCollection Polygones = new PointCollection
{
Point1,
Point2,
Point3
};
Up.Points = Polygones;
Down.Points = Polygones;
RotateTransform myRotateTransform = new RotateTransform
{
CenterX = 15,
CenterY = 7,
};
Подробнее здесь: https://stackoverflow.com/questions/798 ... tion-lingo