Conversation
…ion caused shared references
Introduces DurationBasedAnimationSpec, LoopBasedAnimationSpec, SpringAnimationSpec, TweenAnimationSpec, and IVectorizedAnimationSpec to define and implement various animation behaviors and interfaces for LitMotion. These additions provide a foundation for duration-based, loop-based, spring, and tween animations with vectorized support.
I initially wrote these two, but now I think they may not be necessary. Using IVectorizedAnimationSpec and VectorX should suffice as replacements. Anyway, I'll submit them first, and wait until I decide whether they are needed before pushing them
可能用到的弹簧算法
暂时不知道为什么float比double慢一倍,先改成都用double了 增加了阻尼比和刚度的推荐值
按照原有的方式增加了Spring动画类型 按现在的写法性能会稍差,毕竟正常来说应该把热点逻辑和Tween一样放在update里 不过先按照第一版用着吧,先跑起来再说
|
Thank you for your PR. First, please do not include unnecessary code. Also, please write all documentation comments in English. |
Great to see you back! I'll deal with these later! |
This reverts commit 60d6fe6.
First of all, Merry Christmas and Happy New Year! I finally have time to work on this PR! I previously thought this project was no longer maintained, so I merged code from other PRs without authorization. However, I've now restored all the merged code. I've temporarily deleted the documentation and test folders; perhaps I can add more formal test code and documentation later. I've also added explanations to all my code changes. Some are necessary, and some require discussion. This is my first attempt at contributing code to another open-source library, so I hope you don't mind. Conversely, if you have any complaints, or if I've made any silly mistakes, please let me know! Finally, what type of developer are you? Are you very strict about merging code, requiring it to perfectly match the style of the original project? Or do you welcome such large feature modifications? I'd like to understand your development style for better collaboration. @nuskey8 |
Hi! Bro! Also remember issues188?
I now finally have enough time and motivation to finish it!
This PR introduces physics-based spring animations to LitMotion, bringing natural and responsive motion that simulates real-world spring physics.
🎯 What are Spring Animations?
Spring animations are physics-based animations that simulate the behavior of real-world springs. Unlike traditional linear or easing-based animations, spring animations create motion that starts with high velocity and gradually settles into the target position, mimicking natural physical laws. This creates a more organic and intuitive user experience that feels connected to the real world.
As demonstrated in Apple's Spring Animation Design Principles, spring animations are fundamental to creating fluid, responsive interfaces that users find natural and engaging.
🚀 Why Spring Animations are Superior to Traditional Tweens
1. Natural Physics Simulation
2. Velocity Preservation
3. Dynamic Response
4. Continuous Tracking
🚀 Usage Examples
🔧 Implementation Details
🧪 Testing
Comprehensive test cases and examples are available in
Assets\LitMotion\samples\LitMotion.Spring, including:Test results show that the Spring implementation maintains LitMotion's high performance goal. 1,000,000 Spring animations even consume less energy than Tween!
📚 Documentation
I've uploaded three documents: the description, API documentation, and feature documentation. When you merge them, you can update them into the original documents!