本帖最后由 qiaoke_song 于 2021-6-29 19:00 编辑
说明:
gif录制质量差,就不再录制了,就贴了一张图。
就3个函数,可进行多种配置,实现不同效果。
可应用于连续浏览组件(图像等)、tab切换、弹出对话框等效果。
更多设计模式可参考html5动画(tab、窗体、幻灯播放等):http://www.htmleaf.com/html5/html5donghua/
效果图:
https://img2018.cnblogs.com/blog ... 246139-97293815.gif
代码改编自微软示例代码库:
// Copyright © Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)
[C#] 纯文本查看 复制代码 /// </summary>
/// <param name="translation_control">需动画的组件</param>
/// <param name="mode">模式:0-弹性,2-惯性</param>
/// <param name="orientation">方向:0-正向,1-反向</param>
/// <param name="axis">轴:0-左右,1-上下</param>
/// <param name="delay">延时</param>
/// <param name="_begin">开始动画位置</param>
/// <param name="_end">结束动画位置</param>
/// <param name="amplitude">振幅</param>
/// <param name="suppression">硬度</param>
public void Translation(FrameworkElement translation_control, int mode, int orientation, int axis, double delay, double _begin, double _end, double amplitude = 8, double suppression = 3)
/// </summary>
/// <param name="main">在哪个Grid内</param>
/// <param name="width">组件宽度</param>
/// <param name="height">组件高度</param>
/// <param name="direction">方向:0-横向,1-纵向</param>
/// <param name="rotate_control">组件</param>
/// <param name="begin_angel">起始角度</param>
/// <param name="timeDelay">延时</param>
public CushionRotate(Grid main, double width, double height, int direction, UserControl rotate_control, double begin_angel, double timeDelay)
/// </summary>
/// <param name="mode">模式:0-弹性,1-惯性</param>
/// <param name="amplitude">振幅</param>
/// <param name="suppression">硬度</param>
public void Rotate(int mode, double amplitude = 8, double suppression = 3)
案例源码下载-回复可见:
|