@@ -2457,12 +2457,31 @@ Plotly.relayout = function relayout(gd, astr, val) {
2457
2457
} ;
2458
2458
2459
2459
/**
2460
- * Animate to a keyframe
2460
+ * Animate to a frame, sequence of frame, frame group, or frame definition
2461
+ *
2462
+ * @param {string id or DOM element } gd
2463
+ * the id or DOM element of the graph container div
2464
+ *
2465
+ * @param {string or object or array of strings or array of objects } frameOrGroupNameOrFrameList
2466
+ * a single frame, array of frames, or group to which to animate. The intent is
2467
+ * inferred by the type of the input. Valid inputs are:
2468
+ *
2469
+ * - string, e.g. 'groupname': animate all frames of a given `group` in the order
2470
+ * in which they are defined via `Plotly.addFrames`.
2471
+ *
2472
+ * - array of strings, e.g. ['frame1', frame2']: a list of frames by name to which
2473
+ * to animate in sequence
2474
+ *
2475
+ * - object: {data: ...}: a frame definition to which to animate. The frame is not
2476
+ * and does not need to be added via `Plotly.addFrames`. It may contain any of
2477
+ * the properties of a frame, including `data`, `layout`, and `traces`. The
2478
+ * frame is used as provided and does not use the `baseframe` property.
2479
+ *
2480
+ * - array of objects, e.g. [{data: ...}, {data: ...}]: a list of frame objects,
2481
+ * each following the same rules as a single `object`.
2461
2482
*
2462
- * @param {string } name
2463
- * name of the keyframe to create
2464
2483
* @param {object } animationOpts
2465
- * configuration for animation
2484
+ * configuration for the animation
2466
2485
*/
2467
2486
Plotly . animate = function ( gd , frameOrGroupNameOrFrameList , animationOpts ) {
2468
2487
gd = getGraphDiv ( gd ) ;
@@ -2665,13 +2684,7 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
2665
2684
return frame ;
2666
2685
}
2667
2686
2668
- // Disambiguate what's been received. The possibilities are:
2669
- //
2670
- // - group: 'groupname': select frames by group name
2671
- // - frames ['frame1', frame2']: a list of frames
2672
- // - object: {data: ...}: a single frame itself
2673
- // - frames [{data: ...}, {data: ...}]: a list of frames
2674
- //
2687
+ // Disambiguate what's sort of frames have been received
2675
2688
var i , frame ;
2676
2689
var frameList = [ ] ;
2677
2690
var allFrames = frameOrGroupNameOrFrameList === undefined || frameOrGroupNameOrFrameList === null ;
@@ -2730,15 +2743,23 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
2730
2743
} ;
2731
2744
2732
2745
/**
2733
- * Create new keyframes
2746
+ * Register new frames
2747
+ *
2748
+ * @param {string id or DOM element } gd
2749
+ * the id or DOM element of the graph container div
2734
2750
*
2735
2751
* @param {array of objects } frameList
2736
2752
* list of frame definitions, in which each object includes any of:
2737
- * - name: {string} name of keyframe to add
2753
+ * - name: {string} name of frame to add
2738
2754
* - data: {array of objects} trace data
2739
2755
* - layout {object} layout definition
2740
2756
* - traces {array} trace indices
2741
- * - baseframe {string} name of keyframe from which this keyframe gets defaults
2757
+ * - baseframe {string} name of frame from which this frame gets defaults
2758
+ *
2759
+ * @param {array of integers) indices
2760
+ * an array of integer indices matching the respective frames in `frameList`. If not
2761
+ * provided, an index will be provided in serial order. If already used, the frame
2762
+ * will be overwritten.
2742
2763
*/
2743
2764
Plotly . addFrames = function ( gd , frameList , indices ) {
2744
2765
gd = getGraphDiv ( gd ) ;
@@ -2816,7 +2837,10 @@ Plotly.addFrames = function(gd, frameList, indices) {
2816
2837
} ;
2817
2838
2818
2839
/**
2819
- * Delete keyframes
2840
+ * Delete frame
2841
+ *
2842
+ * @param {string id or DOM element } gd
2843
+ * the id or DOM element of the graph container div
2820
2844
*
2821
2845
* @param {array of integers } frameList
2822
2846
* list of integer indices of frames to be deleted
0 commit comments