Изменение размера окна не влияет на раскадровку, траектория движения сохраняет исходный размер - PullRequest
0 голосов
/ 10 февраля 2019

Я только что сделал траекторию движения в раскадровке в xaml и заметил, что, если я изменю размер окна или увеличу его размер, траектория движения, которую я установил для прямоугольника, который должен делать Ellipse, чтобы сделать орбиту, все равно будет работать как размер окна.не влияет на это.

Я пытаюсь сделать прямоугольник отзывчивым, но это работает только для размера, а не для пути.

   <Page.Resources>
      <Storyboard x:Key="orbit_planet">
          <DoubleAnimationUsingPath Duration="0:0:4" Source="X" 
 Storyboard.TargetProperty="(UIElement.RenderTransform). 
 (TransformGroup.Children)[3].(TranslateTransform.X)" 
 Storyboard.TargetName="rectangle" RepeatBehavior="Forever">
             <DoubleAnimationUsingPath.PathGeometry>
                 <PathGeometry Figures="M498.5,-45.25 C498.5,13.568326 
 405.15137,61.25 290,61.25 C174.84863,61.25 81.5,13.568326 81.5,-45.25 
 C81.5,-104.06833 174.84863,-151.75 290,-151.75 C405.15137,-151.75 
 498.5,-104.06833 498.5,-45.25 z"/>
             </DoubleAnimationUsingPath.PathGeometry>
          </DoubleAnimationUsingPath>
         <DoubleAnimationUsingPath Duration="0:0:4" Source="Y" 
 Storyboard.TargetProperty="(UIElement.RenderTransform). 
 (TransformGroup.Children)[3].(TranslateTransform.Y)" 
 Storyboard.TargetName="rectangle" RepeatBehavior="Forever">
             <DoubleAnimationUsingPath.PathGeometry>
                 <PathGeometry Figures="M498.5,-45.25 C498.5,13.568326 
 405.15137,61.25 290,61.25 C174.84863,61.25 81.5,13.568326 81.5,-45.25 
 C81.5,-104.06833 174.84863,-151.75 290,-151.75 C405.15137,-151.75 
 498.5,-104.06833 498.5,-45.25 z"/>
              </DoubleAnimationUsingPath.PathGeometry>
          </DoubleAnimationUsingPath>
          <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=" 
 (UIElement.RenderTransform).(TransformGroup.Children)[0]. 
 (ScaleTransform.ScaleX)" Storyboard.TargetName="rectangle">
             <EasingDoubleKeyFrame KeyTime="0" Value="0.7"/>
             <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0.8"/>
             <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0.9"/>
             <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
             <EasingDoubleKeyFrame KeyTime="0:0:1.3" Value="0.9"/>
             <EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="0.8"/>
             <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.7"/>
             <EasingDoubleKeyFrame KeyTime="0:0:2.3" Value="0.6"/>
             <EasingDoubleKeyFrame KeyTime="0:0:2.6" Value="0.5"/>
             <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0.4"/>
             <EasingDoubleKeyFrame KeyTime="0:0:3.3" Value="0.5"/>
             <EasingDoubleKeyFrame KeyTime="0:0:3.6" Value="0.6"/>
             <EasingDoubleKeyFrame KeyTime="0:0:4" Value="0.7"/>
         </DoubleAnimationUsingKeyFrames>
         <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty=" 
 (UIElement.RenderTransform).(TransformGroup.Children)[0]. 
 (ScaleTransform.ScaleY)" Storyboard.TargetName="rectangle">
             <EasingDoubleKeyFrame KeyTime="0" Value="0.7"/>
             <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0.8"/>
             <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0.9"/>
             <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
             <EasingDoubleKeyFrame KeyTime="0:0:1.3" Value="0.9"/>
             <EasingDoubleKeyFrame KeyTime="0:0:1.6" Value="0.8"/>
             <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.7"/>
             <EasingDoubleKeyFrame KeyTime="0:0:2.3" Value="0.6"/>
             <EasingDoubleKeyFrame KeyTime="0:0:2.6" Value="0.5"/>
             <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0.4"/>
             <EasingDoubleKeyFrame KeyTime="0:0:3.3" Value="0.5"/>
             <EasingDoubleKeyFrame KeyTime="0:0:3.6" Value="0.6"/>
             <EasingDoubleKeyFrame KeyTime="0:0:4" Value="0.7"/>
         </DoubleAnimationUsingKeyFrames>
     </Storyboard>
 </Page.Resources>
<Page.Triggers>
    <EventTrigger RoutedEvent="FrameworkElement.Loaded">
        <BeginStoryboard Storyboard="{StaticResource orbit_planet}"/>
    </EventTrigger>
</Page.Triggers>
<Grid>
    <Grid.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="White"/>
        </LinearGradientBrush>
    </Grid.Background>
    <Ellipse Margin="181.5,130.5,200.5,105.5" Stroke="Black"/>
    <Rectangle x:Name="rectangle" HorizontalAlignment="Left" Height="100" 
  Margin="54,0,0,126" Stroke="Black" VerticalAlignment="Bottom" Width="100" 
  RenderTransformOrigin="0.5,0.5">
        <Rectangle.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
         </Rectangle.RenderTransform>
         <Rectangle.Fill>
             <ImageBrush ImageSource="Images/apple.png"/>
         </Rectangle.Fill>
      </Rectangle>
       </Grid>
       </Page>

Я хочу изменить путь по размеру окна.это возможно только в xaml.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...