0

私はこの特定の効果を与えるための創造的な解決策を考え出そうとしています:

私の最初のアイデア:クロマキーシェーダー効果を備えた動的なサイズの長方形は、テキスト上の所定の位置にスライドします。ただし、シェーダーで発生しがちなテキストエッジの忠実度を損なうことはしたくありません。

FormattedTextクラスの使用も検討しましたが、これが私がやろうとしていることをサポートしているかどうかはわかりません。

助言がありますか?

編集 明確にするために、テキストは本質的に「TabItem」になります。ハイライトされたブロックをすべてのタブアイテムから選択したアイテムにフロートさせたいです。それらは現在、それらの配置を処理するロジックを備えたCanvasに配置されています。単純なアニメーションでは、見た目だけでは不十分です。

4

1 に答える 1

3

これにより、必要な効果が得られるはずです。これは色にグラデーション ブラシを使用しますが、3 つのグラデーション ストップを使用して、間にグラデーションがなく、色がすぐに変化するようにします。

<Window
    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:TestingWPF"
    mc:Ignorable="d"
    x:Class="TestingWPF.TestWindow"
    d:DesignWidth="477" d:DesignHeight="214"
    Background="Black">

    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="74" FontWeight="Bold">
        <TextBlock.Foreground>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="White" Offset="0"/>
                <GradientStop x:Name="WhiteOffset" Color="White" Offset="1"/>
                <GradientStop x:Name="GrayOffset" Color="Gray" Offset="1"/>
            </LinearGradientBrush>
        </TextBlock.Foreground>
        <TextBlock.Triggers>
            <EventTrigger RoutedEvent="Loaded">
                <BeginStoryboard>
                    <Storyboard Storyboard.TargetProperty="Offset" Duration="0:0:1" RepeatBehavior="Forever">
                        <DoubleAnimation Storyboard.TargetName="WhiteOffset" From="0" To="1" />
                        <DoubleAnimation Storyboard.TargetName="GrayOffset" From="0" To="1" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </TextBlock.Triggers>
        Some Text
    </TextBlock>
</Window>
于 2012-05-31T21:59:44.917 に答える