HTML5 Canvas 弧形教程
要使用 Konva 创建弧形,我们可以实例化一个 Konva.Arc() 对象。
有关属性和方法的完整列表,请参阅 弧形 API 参考。
- Vanilla
- React
- Vue
- Svelte
- Angular
<script>
import { Stage, Layer, Arc } from 'svelte-konva';
const width = window.innerWidth;
const height = window.innerHeight;
</script>
<Stage config={{ width, height }}>
<Layer>
<Arc
config={{
x: width / 2,
y: height / 2,
innerRadius: 40,
outerRadius: 70,
angle: 60,
fill: 'yellow',
stroke: 'black',
strokeWidth: 4
}}
/>
</Layer>
</Stage>