antvis / antvis/G

自定义线条样式未生效

Open
#1,734 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
230
PR merge metrics
No merged PRs in 30d

Description

import { subStyleProps, Quadratic } from '@antv/g6';
import { Circle, Line } from '@antv/g';

export class FlyMarkerCubic extends Quadratic {
getMarkerStyle(attributes) {
return { r: 5, fill: '#c3d5f9', offsetPath: this.shapeMap.key, ...subStyleProps(attributes, 'marker') };
}
getLineStyle(attributes) {
return { stroke: '#c3d5f9', offsetPath: this.shapeMap.key, ...subStyleProps(attributes, 'marker') };
}
onCreate() {
const marker = this.upsert('marker', Circle, this.getMarkerStyle(this.attributes), this);
marker?.animate([{ offsetDistance: 0 }, { offsetDistance: 1 }], {
duration: 3000,
iterations: Infinity,
});
const line = this.upsert('line_style', Line, this.getLineStyle(this.attributes), this);
line.animate([{ lineDashOffset: 20 }, { lineDashOffset: 0 }], {
duration: 500,
iterations: Infinity,
});
}
}

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the example with FlyMarkerCubic and inspect the getLineStyle and onCreate entry points, especially the Line created through upsert. Compare the requested custom line style with the rendered result and confirm the line styling is applied and remains visible during animation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.