Skip to content

ShapeAnimationGenerator is not setting lineDashPhase for Stroke.offset #496

@fangpenlin

Description

@fangpenlin

I tried simple animation on offset of stroke like this

let line = Line(
        x1: 0, y1: 100,
        x2: 300, y2: 100 
    )
    .stroke(with: Stroke(fill: Color.black, width: 3))
let animation = line.strokeVar.animation(
    from: Stroke(fill: Color.black, width: 5, dashes: [5, 100], offset: 0),
    to: Stroke(fill: Color.red, width: 5, dashes: [5, 100], offset: 20),
    during: 1.0,
    delay: 0.0
)
animation.autoreversed().cycle().play()

And it looks like the animation for the line here is not working at all. After looking into source code, I realized that lineDashPhase is not set for Stroke.offset in ShapeAnimationGenerator.

https://github.com/exyte/Macaw/blob/master/Source/animation/types/animation_generators/ShapeAnimationGenerator.swift#L109

and

https://github.com/exyte/Macaw/blob/master/Source/animation/types/animation_generators/ShapeAnimationGenerator.swift#L195-L203

I will open a PR shortly addressing this lineDashPhase animation missing bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions