Skip to content

NativeAnimatedModule - #2556

Merged
Stephen L Peters (StephenLPeters) merged 14 commits into
microsoft:masterfrom
StephenLPeters:NativeDriver
Jun 28, 2019
Merged

Stephen L Peters (StephenLPeters) merged 14 commits into
microsoft:masterfrom
StephenLPeters:NativeDriver

Conversation

@StephenLPeters

@StephenLPeters Stephen L Peters (StephenLPeters) commented Jun 3, 2019 •

Copy link
Copy Markdown
Contributor

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

@ghost ghost added the vnext label Jun 3, 2019

modules.emplace_back(
NativeAnimatedModule::name,
[nativeAnimated = std::move(nativeAnimated)]() mutable { return std::make_unique<NativeAnimatedModule>(nativeAnimated); },

@licanhua Canhua Li (licanhua) Jun 3, 2019 •

Copy link
Copy Markdown
Contributor

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 {

@PPatBoyd Patrick Boyd (PPatBoyd) Jun 3, 2019 •

Copy link
Copy Markdown
Contributor

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; };

Copy link
Copy Markdown
Contributor

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;

Copy link
Copy Markdown
Contributor

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

@ghost ghost added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Jun 3, 2019
@ghost ghost removed the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Jun 20, 2019
@StephenLPeters Stephen L Peters (StephenLPeters) changed the title Opacity Animation Via NativeAnimatedModule NativeAnimedModule Jun 24, 2019
…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 kmelmon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@ghost ghost added Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) and removed Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) labels Jun 24, 2019

@kmelmon kmelmon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ahimberg Andy Himberger (ahimberg) left a comment

Copy link
Copy Markdown
Contributor

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

@ahimberg Andy Himberger (ahimberg) changed the title NativeAnimedModule NativeAnimatedModule Jun 26, 2019
…nager keep collections of unique pointers instead of shared pointers.
…ed with getters that return a reference to the underlying node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants