HTML5 canvas 弧形教程
要使用 Konva
创建一个弧形,我们可以实例化一个 Konva.Arc()
对象。
有关完整的属性和方法列表,请参阅 Arc API 参考。
- Vanilla
- React
- Vue
- Svelte
<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>