当前位置:网站首页>WPF basic animation
WPF basic animation
2022-06-11 00:58:00 【Nidhogg_ com】
1、 Basic animation .
WPF A more advanced model is provided , Through this model, we can only focus on the definition of animation , Regardless of how they are rendered , This model is based on the dependency property infrastructure , Essentially ,WPF Animation is just a way to modify the value of a dependency property over a period of time . But there is another limitation , In order to realize the dynamic of attributes , Animation that supports the corresponding data type is required class , for example Button.Width Property uses the double data type , To realize the dynamic of attributes , Need to use DoubleAnimation class , but Button.Padding The property uses Thickness junction structure , So we need to use ThicknessAnimation class . To animate attributes , You can create your own animation classes for the corresponding data types , You will send present ,System.Windows.Media.Animation Namespaces already provide animation classes for most of the data types you want to use .
2、 Animation class .
There are actually two types of animation , One is an animation that changes attributes in a step-by-step manner between the start value and the end value ( Linear interpolation process ), The other is to suddenly change from one value to another draw ( Keyframe animation ). All keyframe animations use " Type name + AnimationUsingKeyFrames " The form of naming , such as StringAnimationUsingKeyFrames and ObjectAnimationUsingKeyFrames. Some data types have keyframe animation classes , But there is no interpolation animation class . for example , You can use keyframes to animate strings , You cannot use interpolation for words String application animation . However , All data types support keyframe animation , Unless they don't support animation at all . All have ( Use interpolation ) Data type of general animation class , There are also corresponding keys Animation type of frame animation , Such as linear interpolation DoubleAnimation Corresponding DoubleAnimationUsingKyyFrames. There is also a path based animation . therefore ,WPF Animation use three Methods : linear interpolation 、 Keyframes and paths . stay System.Windows.Media.Animation The following will be found in the namespace :
7 individual “ Type name +Animation class ” These classes use interpolation animation .
22 individual “ Type name +AnimationUsingKeyFrames” These classes use keyframe animation .
3 individual " Type name +AnimationUsingPath" This class uses path based animation .
3. The life cycle of animation .
From the perspective of Technology ,WPF Animation is only temporary , This means that they can't really change the value of the basic attribute , When animation is active , It just overrides the value of the attribute . One way animation , It will remain active after the animation runs , This is because the animation needs to keep the width of the button at a new value , This can lead to the following common problems , If you try to use code in animation Modify the attribute value after completion , The code will not work , Because the code just specifies a new local value for the property , But we will try out the attribute values after the animation first . In order to solve the problem that the value of the attribute can be modified after the animation is completed , There are the following ways to solve .
a)、 Set up AutoReverse attribute , If this property is set to true, Will move in the opposite direction , Return the original value ( Not suitable for animation after completion , Then set the final value for the attribute , Just revert to animation Previous value ).
b)、 change FillBehavior attribute . Usually ,FillBehavior Property is set to HoldEnd, This means that when the animation ends , Will continue to apply the final value for the target element . If you will FillBehavior Attribute to Stop, As long as the animation is over , Property will return to its original value ( Apply to the end of the animation , Set a new value for it again , Generally not related to AutoReverse Use in conjunction with , These two are used Just one ).
边栏推荐
- 项目连接不到远程虚拟机The driver has not received any packets from the server.
- Logback log framework
- 对象作为点(Objects as Points) 个人总结
- [network planning] 3.2 transport layer - UDP: connectionless service
- C language implementation setting desktop wallpaper
- RPC details
- Qt线程与界面
- 团队管理|如何提高技术Leader的思考技巧?
- 适配器模式
- Deploy netron services through kubernetes and specify model files at startup
猜你喜欢

What is the difference between hubs, switches and routers?

DevOps到底是什么意思?

Small project on log traffic monitoring and early warning | environment and foundation 1

浅谈有赞搜索质量保障体系 v2021

手把手教你前后分离架构(五) 系统身份验证实现

C语言实现设置桌面壁纸

大厂是面对深度分页问题是如何解决的(通俗易懂)

Blocking queue - delayedworkqueue source code analysis

Logback log framework

SLAM卡尔曼滤波&&非线性优化
随机推荐
About log traffic monitoring and early warning small project | Kafka vs redis
Unable to return to the default page after page Jump
AQS explanation of concurrent programming
87.(leaflet之家)leaflet军事标绘-直线箭头修改
Test it first
Alicloud configures SLB (load balancing) instances
What is MYCAT? Get to know you quickly
网络工程师必修课防火墙安全区域及安全策略基础操作
Deploy netron services through kubernetes and specify model files at startup
How to install mathtype6.9 and related problem solutions in office2016 (word2016)
阻塞隊列 — DelayedWorkQueue源碼分析
table_exists_action=append和table_exists_action=truncate
day01
About log traffic monitoring and early warning small project | flask
Volatile keyword for concurrent programming
The principle and source code interpretation of executor thread pool in concurrent programming
Baidu PaddlePaddle paddlepaddle latest series AI course playback address
动态规划经典题目三角形最短路径
What is thread in concurrent programming
WIN11卸载小组件