Skip to content
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

Generic prop transition #3443

Merged
merged 6 commits into from Aug 27, 2019
Merged

Generic prop transition #3443

merged 6 commits into from Aug 27, 2019

Conversation

Pessimistress
Copy link
Collaborator

@Pessimistress Pessimistress commented Aug 13, 2019

For https://github.com/uber/deck.gl/blob/master/dev-docs/RFCs/v7.x/property-transition-rfc.md

Change List

  • Update prop transition RFC
  • Drop support for luma-style function uniforms
  • Support uniform transition in primitive layers
  • Support elevationScale and coverage transitions in HexagonLayer
  • Update HexagonLayer example
  • Tests

TODO

  • Update all composite layers to map prop transition settings
  • Update layer docs to mark transition-enabled props

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

I don't have any strong objections to this approach. I should take one more look but as far as I can tell it does avoid most of the deck.gl diffing overhead and just runs in the animation loop calls.

The main part that probably merits some face-to-face discussion/brain storming is of course the layer.prop override.

Mixed comments:

  • Overriding props seems a little like a silver bullet, in that we may only get to fire it once (overriding in several layers might get too complex), is this the right use for it?

-Interesting to discuss what alternatives would be. Passing in prop overrides to draw? Setting up transition functions for luma.gl props.

  • Worth discussing our uniform strategy before pulling the trigger?

  • Do we really want layers to set uniforms every draw call? The prop update system is based on that. How is the move to uniform buffers going to happen.

Perhaps a uniform manager that would be able to handle this without prop overriides?

Nits:

  • The props override generates a bunch of GC objects (Object.create) during transitions. Probably hard to avoid even in alternative implementations.

@@ -128,15 +83,19 @@ export class App extends Component {
coverage,
data,
elevationRange: [0, 3000],
elevationScale: this.state.elevationScale,
elevationScale: data && data.length ? 50 : 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

One almost wants a way to specify that "transitions" should start at data load time, so this could be dropped...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the website data is passed in from the parent, so onDataLoad will not fire.

modules/core/src/lib/layer-manager.js Outdated Show resolved Hide resolved
modules/core/src/lib/layer.js Outdated Show resolved Hide resolved
modules/core/src/lib/layer.js Outdated Show resolved Hide resolved
if (transitions.size > 0) {
// clone props
const propsInTransition = transitions.update();
const props = Object.create(this.props);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nits:

  • Generates a bunch of GC objects during transitions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the safest and cheapest way to duplicate the props object with some overrides. We do the same when an async prop is loaded, a layer is cloned, etc.

modules/core/src/lib/layer.js Outdated Show resolved Hide resolved
if (!uniforms.picking_uActive) {
this.updateTransition();
// Overwrite this.props during redraw to use in-transition prop values
this.props = this.updateTransition();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated: The fact that layer.props can be changed is interesting. Wonder if applications could use that to subvert having to create new layers...

modules/core/src/lib/uniform-transition-manager.js Outdated Show resolved Hide resolved
}

const {opacity} = this.props;
// apply gamma to opacity to make it visually "linear"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Seems like this gamma conversion should be specified in a table somewhere, rather than being a special case here, could even be in the prop types...

@Pessimistress Pessimistress changed the title [POC] generic prop transition Generic prop transition Aug 26, 2019
@Pessimistress Pessimistress marked this pull request as ready for review August 27, 2019 00:01
@coveralls
Copy link

coveralls commented Aug 27, 2019

Coverage Status

Coverage increased (+0.6%) to 80.999% when pulling 8594837 on x/prop-transition into c55cbff on master.

@Pessimistress
Copy link
Collaborator Author

Setting up transition functions for luma.gl props? Perhaps a uniform manager that would be able to handle this without prop overrides?

Many layers manipulate their props before sending them to uniforms. Any approach other than overriding the props object would essentially require all layers to remember not to use the prop value as is and do something different.

Do we really want layers to set uniforms every draw call? The prop update system is based on that. How is the move to uniform buffers going to happen.

I am moving the update of transition into updateState(), and overriding this.props in both state update and draw calls.

@Pessimistress Pessimistress merged commit 1c0005d into master Aug 27, 2019
@Pessimistress Pessimistress deleted the x/prop-transition branch August 27, 2019 22:32
ajduberstein pushed a commit that referenced this pull request Aug 28, 2019
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.

None yet

4 participants