Skip to content

Unable to animate the Line element #122

@cduck

Description

@cduck

Discussed in #121

Originally posted by PieterMostert March 2, 2024
I've tried modify the example in the README to animate the endpoints of a line, but nothing happens:

import drawsvg as draw

d = draw.Drawing(400, 200, origin='center',
        animation_config=draw.types.SyncedAnimationConfig(
            # Animation configuration
            duration=8,  # Seconds
            show_playback_progress=True,
            show_playback_controls=True))

line = draw.Line(0, 0, 0, 200, stroke_width=4, stroke='red')  # Moving line
line.add_key_frame(0, sx=0, sy=0,  ex=200, ey=0)
line.add_key_frame(8, sx=0, sy=200,  ex=0, ey=0)
d.append(line)

d.display_inline()  # Display as interactive SVG

Am I doing something wrong, or is this a bug? Either way, I'd appreciate advice on how to get this to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions