-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[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
Conversation
9e6e733
to
f50c295
Compare
exports.deleteFrames = Plotly.deleteFrames; | ||
exports.renameFrame = Plotly.renameFrame; | ||
exports.transition = Plotly.transition; | ||
exports.animate = Plotly.animate; |
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.
@rreusser oops ... two Plotly.animate
got in.
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.
Fixed & removed renameFrame
edaf8fe
to
28be237
Compare
* - 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 |
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.
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
)?
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.
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']
}
}
};
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.
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); |
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.
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.
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.
additional note to self: stop reviewing own PR.
3e5f4af
to
bfa1c07
Compare
bfa1c07
to
3e18a98
Compare
5d1eb2d
to
01b9287
Compare
|
||
expect(ext.foo.bar).toBe(src.foo.bar); | ||
expect(ext.foo.baz).toBe(src.foo.baz); | ||
expect(ext.foo.bop).toBe(tar.foo.bop); |
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.
fantastic 🎉
1203f10
to
42467ec
Compare
}); | ||
}); | ||
|
||
describe('circularly defined frames', function() { |
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.
🎉 great.
Conflicts: src/traces/scatter/plot.js
… animate-api-take-3 Conflicts: src/components/errorbars/plot.js src/core.js src/traces/scatter/plot.js
New PR since switching to plotly's GH repo. I think this one is the real deal, at last.
Tasks
Plotly.addFrames
(see:addFrames
docs)Plotly.deleteFrames
(see:deleteFrames
docs)Plotly.transition
Plotly.animate
Known Issues
layout.slider
control