Skip to content

Commit c7be054

Browse files
committed
Really simple .animate function
1 parent cdfec13 commit c7be054

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/plot_api/plot_api.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,17 +2595,22 @@ Plotly.transition = function(gd /*, data, layout, traces, transitionConfig*/) {
25952595
* @param {object} transitionConfig
25962596
* configuration for transition
25972597
*/
2598-
Plotly.animate = function(gd, name /*, transitionConfig*/) {
2598+
Plotly.animate = function(gd, frameName, transitionConfig) {
25992599
gd = getGraphDiv(gd);
26002600

2601-
var _frames = gd._frameData._frames;
2602-
2603-
if(!_frames[name]) {
2604-
Lib.warn('animateToFrame failure: keyframe does not exist', name);
2601+
if(!gd._frameData._frameHash[frameName]) {
2602+
Lib.warn('animateToFrame failure: keyframe does not exist', frameName);
26052603
return Promise.reject();
26062604
}
26072605

2608-
return Promise.resolve();
2606+
var computedFrame = Plots.computeFrame(gd, frameName);
2607+
2608+
return Plotly.transition(gd,
2609+
computedFrame.data,
2610+
computedFrame.layout,
2611+
computedFrame.traceIndices,
2612+
transitionConfig
2613+
);
26092614
};
26102615

26112616
/**

0 commit comments

Comments
 (0)