Skip to content

Animating a line #121

Answered by cduck
PieterMostert asked this question in Q&A
Mar 2, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

This is a bug because the underlying SVG tag used by Line is <path>, not <line>. I've opened issue #122 for this.

Workaround:

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))

class Line(draw.DrawingBasicElement):
    '''A line element that uses the SVG <line> tag.

    The endpoints of this custom Line element can be animated.  This is a workaround because `drawsvg.Line`
    cannot be animated.'''
    TAG_NAME = 'line'

    def __init__(self, x1, y1, x2, y2, **

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PieterMostert
Comment options

Answer selected by cduck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants