javascript - SVG Circle 不会在 viewBox ract native 中居中
问题描述
我有两个 SVG 圆形元素,一个嵌套在另一个内部。最外面的圆圈(橙色)似乎没有任何填充并与 viewBox 的边框重叠。
如何将圆圈定位在内部,viewBox
以便没有重叠并且圆圈不会被切断?
<View style={{ alignContent: "center", alignSelf: "center" }}>
<Svg
height="250"
width="250"
viewBox="0 0 100 100"
style={{ zIndex: 1, borderWidth: 1 }}
>
{/* OUTTER ORANGE CIRCLE */}
<Circle
stroke="#FF8540"
fill="none"
cx="50"
cy="50"
r={radius}
strokeWidth="3"
transform={`rotate(52.5 ${"50"} ${"50"})`}
strokeDasharray={[dash, circumference - dash]}
strokeLinecap="round"
style={{ transition: "all 0.5s" }}
/>
{/* INNER TEAL CIRCLE */}
<Circle
stroke="#1AA39B"
fill="none"
cx="50"
cy="50"
r={radius * 0.8}
strokeWidth="3"
transform={`rotate(-152.5 ${"50"} ${"50"})`}
strokeDasharray={[dash, circumference - dash]}
strokeLinecap="round"
style={{ transition: "all 0.5s" }}
/>
</Svg>
</View>
解决方案
推荐阅读
- ios - NSLayoutConstraint - 两项,一行,间距优先
- android - 如何在改造 2 上发布整个数据库
- xamarin.forms - 未应用 CornerRadius
- r - 在 R dplyr 中按组将多列转换为相对频率
- apache-spark - 在 PySpark Structured Streaming 中为多个输出流使用单个流数据帧
- c - 从C中的void函数返回一个值
- javascript - addClass() 仅指向子元素(而不是嵌套元素)
- c - realloc 在第二次调用时失败
- python - 弹出索引超出范围python
- php - 如何从 MySQL 中获取值以选择/选项标签