实现效果如下:

思路:加载预设数量的Image控件,在鼠标移动时设置TranslateTransform的偏移量。
步骤:
1、MyImageControl2D自定义控件
布局:
<Grid x:Name="mainGrid" ClipToBounds="True" Cursor="Hand">
</Grid>
交互逻辑:
public static readonly DependencyProperty ShowImageProperty = DependencyProperty.Register("ShowImage", typeof(ImageSource), typeof(MyImageControl2D), new PropertyMetadata(null));
public ImageSource ShowImage
{
get { ret
本文介绍如何在WPF中实现图像倾斜视差效果。通过自定义MyImageControl2D控件,利用TranslateTransform调整Image控件的偏移量,实现随鼠标移动而变化的效果。
订阅专栏 解锁全文
7274

被折叠的 条评论
为什么被折叠?



