Android's Ripple Effect in WPF

前端 未结 3 1967
萌比男神i
萌比男神i 2021-01-31 18:05

I love Androids new animation where you touch a control (listviewitem, button etc etc) and it does a neat animation like this:

3条回答
  •  既然无缘
    2021-01-31 18:40

    I suggest using Custom Controls over UserControls for this. Almost everything could be handled in xaml that way. Once you have your control styled then all you have to do is add an Ellipse and set a MouseDown or Button.Pressed trigger to your ControlTemplate.Triggers. Then your animation would only need to increase the height and width of the Ellipse until the ripple effect was completed then fade the Opacity to 0.

    For the Ellipse make sure you have the position fixed and for the same color scheme try a white fill and an opacity of 0.3-5.

    For the ring effect on the button in the top corner of your add a 2nd Ellipse set the Fill to Transparent and the Stroke to White.

提交回复
热议问题