yapabilirsiniz Örneğin, vuruşunuza bir Degrade uygulayın; Ben size oldukça olurdu ima etmeye çalıştığını düşünüyorum gibi tüm inme ve meyil ve tek bir çizgi uygulayacaktır Ancak
. Orada sorduğun şey mümkün değil. Ancak
Quickie Konsept Örnek:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Storyboard x:Key="GradientChaser" RepeatBehavior="Forever">
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)"
Storyboard.TargetName="rectangle">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/>
</PointAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)"
Storyboard.TargetName="rectangle">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/>
</PointAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource GradientChaser}"/>
</EventTrigger>
</Window.Triggers>
<Grid>
<Rectangle x:Name="rectangle" Width="250" Height="250"
HorizontalAlignment="Center" VerticalAlignment="Center"
StrokeThickness="10">
<Rectangle.Stroke>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Red" Offset="0"/>
<GradientStop Color="Transparent" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
</Grid>
</Window>
Quickie Konsept Örnek Sonuç:
EK:
Ne yazık ki üzerinde düzenleme ve yapmak serbest zaman yok işinizi yapmak için mükemmel ama umarım nasıl yapabileceğinizle ilgili sonra inme gradyan tekniği ile etkisi chieve.
Quickie Güncelleme kod:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Storyboard x:Key="GradientChaser" RepeatBehavior="Forever">
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="rectangle">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/>
</PointAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="rectangle">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/>
</PointAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="GradientChaserOverlay" RepeatBehavior="Forever">
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="rectangle2">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.146,0.146"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.502,-0.001"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.85,0.142"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.863,0.845"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="-0.001,0.498"/>
</PointAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="rectangle2">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.854,0.854"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.498,1.001"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.15,0.858"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.137,0.155"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="1.001,0.502"/>
</PointAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource GradientChaser}"/>
<BeginStoryboard Storyboard="{StaticResource GradientChaserOverlay}"/>
</EventTrigger>
</Window.Triggers>
<Grid>
<Rectangle x:Name="rectangle" Width="250" Height="250" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="10">
<Rectangle.Stroke>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Red" Offset="0"/>
<GradientStop Color="Transparent" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
<Rectangle x:Name="rectangle2" Width="250" Height="250" HorizontalAlignment="Center" VerticalAlignment="Center" StrokeThickness="10">
<Rectangle.Stroke>
<LinearGradientBrush EndPoint="1,0.501" StartPoint="0,0.499">
<GradientStop Color="White" Offset="0.35"/>
<GradientStop Color="Transparent" Offset="0.342"/>
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
</Grid>
</Window>
Şipşak Konsept Sonucu (bazı değişiklik yapmak gerekebileceğini, ama hey, SO ücretsiz kod çalışma hizmeti zaten doğru değil :) Oh ve berbat .gif için üzgün olacak? kalite.
Umut bu, Şerefe yardımcı olur!
Merhaba chris, hızlı cevap için teşekkürler! (Bu kadar hızlı bir animasyon bile oluşturmayı nasıl başardınız? Evet, tam olarak ne demek istediğimi: degradi tek bir çizgiye bile uygulamak. Zaten bunun kolay olmayacağını düşündüm. Bir tire yerine degrade animasyon havalı bir hiledir, ancak bir seferde dikdörtgenin bir tarafının yalnızca bir kısmına kısaltılabilir mi? [bu] gibi bir şey (http://imgur.com/z9UD2DQ) – Mikk
Yea yapabilirsiniz, aksi takdirde kaplamada 2 'GradientStop' noktalarını kullanarak bu kesin sonucu elde etmek için aşağıdaki degradeyi" yönlendirmek "için başka bir Dikdörtgen üst üste bindirmeniz gerekir ince kenar vermek ve bunun altındaki inme tarafından sağlanan şeffaf iz takip etmek. Ne zaman böyle şeyler yapıyorsanız, Visual Studio ile birlikte gelen Blend (eski Expression Blend) kullanmanızı kesinlikle tavsiye ederim. Zaman çizelgesi kaydedici özellikleri vb. Gibi parçaları öğrendikten sonra hayatınızı çok daha kolay hale getirir. İnme/gradyanlar vb. Kullanarak başka bir örneğe ihtiyacınız varsa bunu başka bir zamanda yapmak zorunda kalacağım. –
@Mikk Güncellenmiş cevabımı görün. Muhtemelen danışmanlık ücretlerini şarj etmem gerektiğini fark etmeden önce cevaplar üzerinde bir zaman eşiğim var, şimdiye kadar toplam 10 dakikaya ulaşıyorsunuz, dolayısıyla endişelenmeyin. :) –