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