ClippingPage.xaml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <UserControl
  2. xmlns="https://github.com/avaloniaui"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. x:Class="RenderDemo.Pages.ClippingPage">
  5. <Grid ColumnDefinitions="Auto" RowDefinitions="Auto,Auto">
  6. <Grid.Styles>
  7. <Styles>
  8. <Style Selector="Border#clipped:pointerover">
  9. <Setter Property="Border.Background" Value="Crimson"/>
  10. </Style>
  11. <Style Selector="Border#clipChild">
  12. <Style.Animations>
  13. <Animation Duration="0:0:2" IterationCount="Infinite">
  14. <KeyFrame Cue="100%">
  15. <Setter Property="RotateTransform.Angle" Value="360"/>
  16. </KeyFrame>
  17. </Animation>
  18. </Style.Animations>
  19. </Style>
  20. </Styles>
  21. </Grid.Styles>
  22. <Border Name="clipped"
  23. Background="Yellow"
  24. Width="100"
  25. Height="100"
  26. Clip="M 58.625 0.07421875
  27. C 50.305778 0.26687364 42.411858 7.0346526 41.806641 15.595703
  28. C 42.446442 22.063923 39.707425 13.710754 36.982422 12.683594
  29. C 29.348395 6.1821635 16.419398 8.4359222 11.480469 17.195312
  30. C 6.0935256 25.476803 9.8118851 37.71125 18.8125 41.6875
  31. C 9.1554771 40.62945 -0.070876925 49.146842 0.21679688 58.857422
  32. C 0.21545578 60.872512 0.56758794 62.88911 1.2617188 64.78125
  33. C 4.3821886 74.16708 16.298268 78.921772 25.03125 74.326172
  34. C 28.266843 72.062552 26.298191 74.214838 25.414062 76.398438
  35. C 21.407348 85.589198 27.295992 97.294293 37.097656 99.501953
  36. C 46.864883 102.3541 57.82177 94.726518 58.539062 84.580078
  37. C 58.142158 79.498998 59.307538 83.392694 61.207031 85.433594
  38. C 67.532324 93.056874 80.440232 93.192029 86.882812 85.630859
  39. C 93.836392 78.456939 92.396838 65.538666 84.115234 60.009766
  40. C 79.783641 57.904836 83.569793 58.802369 86.375 58.193359
  41. C 96.383335 56.457569 102.87506 44.824101 99.083984 35.394531
  42. C 95.963498 26.008711 84.047451 21.254079 75.314453 25.849609
  43. C 72.078834 28.113269 74.047517 25.960974 74.931641 23.777344
  44. C 78.93827 14.586564 73.049722 2.8815081 63.248047 0.67382812
  45. C 61.721916 0.22817968 60.165597 0.038541919 58.625 0.07421875 z ">
  46. <Border Name="clipChild" Background="{DynamicResource ThemeAccentBrush}" Margin="4">
  47. <!-- Setting opacity puts the TextBox on a new layer -->
  48. <TextBox Text="Avalonia" Opacity="0.9" VerticalAlignment="Center"/>
  49. <Border.RenderTransform>
  50. <RotateTransform/>
  51. </Border.RenderTransform>
  52. </Border>
  53. </Border>
  54. <CheckBox Name="useMask" IsChecked="True" Grid.Row="1">Apply Geometry Clip</CheckBox>
  55. </Grid>
  56. </UserControl>