-
Notifications
You must be signed in to change notification settings - Fork 1.2k
NativeAnimatedModule #2556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NativeAnimatedModule #2556
Conversation
|
|
||
| modules.emplace_back( | ||
| NativeAnimatedModule::name, | ||
| [nativeAnimated = std::move(nativeAnimated)]() mutable { return std::make_unique<NativeAnimatedModule>(nativeAnimated); }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make_unique [](start = 73, length = 11)
https://stackoverflow.com/questions/37884728/does-c11-unique-ptr-and-shared-ptr-able-to-convert-to-each-others-type
In short, you can easily and efficiently convert a std::unique_ptr to std::shared_ptr but you cannot convert std::shared_ptr to std::unique_ptr.
#Pending
| #include "pch.h" | ||
|
|
||
| namespace react { | ||
| namespace uwp { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything but the animation driver should be shared (graph and nodes should be shared to win32) #Pending
| void Offset(float offset); | ||
| void FlattenOffset(); | ||
| void ExtractOffset(); | ||
| winrt::CompositionPropertySet PropertySet() { return m_propertySet; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this class should likely be shareable with win32, is this the right place for a CompositionPropertySet?
| { | ||
| using namespace ::winrt::Windows::UI::Xaml; | ||
| using namespace ::winrt::Windows::UI::Core; | ||
| using namespace Windows::Foundation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of usings in here; this seems like it could cause a lot of confusion about types. Is sharing the includes with presumably every other cppwinrt file useful? This impacts build times, etc. I wonder if the file should actually be removed instead of extended
…eds to stop an animation prematurely. Fix an issue where a callback in the NativeUiManager's BatchCompleted event added another callback to the list would crash. Respond to some feedback
kmelmon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
kmelmon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
ahimberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mark all the asInt / getInt, and probably missed some for(auto : ) that should be & to avoid copies
…nager keep collections of unique pointers instead of shared pointers.
…ed with getters that return a reference to the underlying node.
ReactNative asks the module to create 'nodes' which hold information which describes the animations. These nodes have a number of types: Value nodes which hold a value which changes over time because of animations. AnimationDriver nodes which associate with a Value node and change that value. Style nodes which associate a value with a string which identifies a property. And finally Props Nodes which associate a style with a particular XamlView.
The actual animations are implemented with composition animations. The value nodes contain a custom CompositionPropertySet which contains values which are animated using Composition::KeyFrameAnimation controlled by the animationdriver nodes. Finally these values are tied to the XamlView using Composition::ExpressionAnimation which are owned by the PropsNodes.
The unimplemented peices are:
1)Tracking Nodes
2)Spring Animations
3)Event Animations
Microsoft Reviewers: Open in CodeFlow