Skip to content

[WIP] Frame + Animate API #717

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

Closed
wants to merge 94 commits into from
Closed

[WIP] Frame + Animate API #717

wants to merge 94 commits into from

Conversation

rreusser
Copy link
Contributor

@rreusser rreusser commented Jul 5, 2016

New PR since switching to plotly's GH repo. I think this one is the real deal, at last.

Tasks

  • merge master (last merged: July 5)
  • SVG element persistence
  • frame API
  • Plotly.transition
    • flag animatable/unanimatable properties (in schema?)
    • axis transitions
    • data transitions
    • restyle/relayout for props that don't fit
    • resolve issue with transforms vs. redrawing svg elements (the point-scaling ugliness)
    • interrupts
  • Plotly.animate

Known Issues

  • simultaneous data transition + layout transition = transform problems
  • error bars not removed/transformed correctly when multiple simultaneous transitions
  • extract non-transitionable properties and restyle separately
  • expand redrawn scatter traces to the full set of interdependent traces
  • tweak fill close order to avoid wraparound ugliness when path point count changes
  • option to disable line simplification
  • flag to preserve autoscale mode?
  • built-in layout.slider control
  • ensure no transitions if duration = 0
  • scrollzoom seems disabled after transition

@rreusser rreusser force-pushed the animate-api-take-3 branch from 9e6e733 to f50c295 Compare July 5, 2016 19:54
exports.deleteFrames = Plotly.deleteFrames;
exports.renameFrame = Plotly.renameFrame;
exports.transition = Plotly.transition;
exports.animate = Plotly.animate;
Copy link
Contributor

Choose a reason for hiding this comment

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

@rreusser oops ... two Plotly.animate got in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed & removed renameFrame

@rreusser rreusser force-pushed the animate-api-take-3 branch from edaf8fe to 28be237 Compare July 5, 2016 20:07
* - data: {array of objects} trace data
* - layout {object} layout definition
* - traces {array} trace indices
* - baseFrame {string} name of keyframe from which this keyframe gets defaults
Copy link
Contributor

@etpinard etpinard Jul 5, 2016

Choose a reason for hiding this comment

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

What about the transition options? For example, the delay and easing function?

Should they be per frame (i.e. specified inside each frame object) or per animation (i.e. pass onto Plotly.animate)?

Copy link
Contributor

Choose a reason for hiding this comment

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

To my 👀 , I think the later makes the most sense.

I like to think of frames as diffs for data and layout. How to transition between these diffs should be a property of the widget (e.g. slider, dropdown menus). For example, given a set of frames a, b, c, then:

var layout = {
  slider: {
    frames: ['a', 'b', 'c'],
    transition: {
      delay: 100,
      duration: 1000,
      easing: 'cubic'
    }
  }
};

and per-frame transition options would then be set as:

var layout = {
  slider: {
    frames: ['a', 'b', 'c'],
    transition: {
      delay: [100, 200, 300],
      duration: [1000, 2000, 3000],
      easing: ['cubic', 'linear', 'sin']
    }
  }
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Works for me, and even if it's some weird unforeseen corner case like d3 zoom transitions, it'd still be defined in the proper place this way.

var ops = [];
var revops = [];

frameList = frameList.splice(0);
Copy link
Contributor Author

@rreusser rreusser Jul 5, 2016

Choose a reason for hiding this comment

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

note to self: *slice. by a stupid coincidence this works, but it destroys the input which was the only reason for this line in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

additional note to self: stop reviewing own PR.

@rreusser rreusser force-pushed the animate-api-take-3 branch from 3e5f4af to bfa1c07 Compare July 6, 2016 16:04
@rreusser rreusser force-pushed the animate-api-take-3 branch from bfa1c07 to 3e18a98 Compare July 6, 2016 16:06
@rreusser rreusser force-pushed the animate-api-take-3 branch from 5d1eb2d to 01b9287 Compare July 6, 2016 18:39

expect(ext.foo.bar).toBe(src.foo.bar);
expect(ext.foo.baz).toBe(src.foo.baz);
expect(ext.foo.bop).toBe(tar.foo.bop);
Copy link
Contributor

Choose a reason for hiding this comment

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

fantastic 🎉

@rreusser rreusser force-pushed the animate-api-take-3 branch from 1203f10 to 42467ec Compare July 6, 2016 20:59
});
});

describe('circularly defined frames', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉 great.

@rreusser rreusser mentioned this pull request Aug 1, 2016
14 tasks
@rreusser rreusser closed this Aug 5, 2016
@rreusser rreusser deleted the animate-api-take-3 branch August 11, 2016 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants