Skip to content

Animations: let 'Play' button support different durations for different frames #5362

@sducouedic

Description

@sducouedic

So far the button Play only support a single frame duration and a single transition duration for all the steps of the animation. It would be very useful to support different duration values at different frame step. Note that I haven't any way to define specific duration per frame, I am open to suggestions.

Current:

fig.update_layout(
    updatemenus=[{
        'type': 'buttons',
        'buttons': [
            {
                'label': 'Play',
                'method': 'animate',
                'args': [None, {
                    'fromcurrent': True,
                    'frame': {'duration': 100, 'redraw': False},
                    'transition': {'duration': 100}
                }]
            }
        ]
    }]
)

Possible alternative way to pass information:

fig.update_layout(
    updatemenus=[{
        'type': 'buttons',
        'buttons': [
            {
                'label': 'Play',
                'method': 'animate',
                'args': [None, {
                    'fromcurrent': True,
                    'frame': [(str(i), {'duration': 100 if i%2 == 0 else 1000, 'redraw': False}) for i in range(len(frames))],
                    'transition': [(str(i), {'duration': 100 if i%2 == 0 else 1000}) for i in range(len(frames))]
                }]
            }
        ]
    }]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogcommunitycommunity contributionfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions