SVG에서 그런 것을 얻고 싶습니다. 지금까지 서클을 만들었지 만 주변에 검은 색 영역을 올바르게 배치하려고합니다.원 안에있는 SVG 호 영역
- start_angle :
하는 API입니다 네 개의 값을 반환 첫 번째 각도는
- end_angle (라디안으로 보이는) : 최종 각도
- inner_radius (라디안으로 보이는) : 작은 반경
- outer_radius : 더 큰 반경 여기
내가 원하는 무엇을 계획이다 0 나는 자바 스크립트와 SVG를 만들고있어 1,236,
그래서 내 코드는 다음과 같이이다.
var myArc = document.createElementNS('http://www.w3.org/2000/svg', 'path');
myArc.setAttribute('fill', 'black');
myArc.setAttribute('d', 'M-'+outer_radius+',32A'+outer_radius+','+outer_radius+' 0 0,1 -'+outer_radius+',-32L-'+inner_radius+',-30A'+inner_radius+','+inner_radius+' 0 0,0 -'+inner_radius+',30Z');// TODO
arcs.appendChild(myArc);
이것은 하나의 영역을 그릴 수 있습니다하지만 난에 넣어 값 모르는 내가했습니다 사용할 지점을 결정하려고했지만 작동하지 않습니다.
var pointA = [outer_radius * Math.cos(start_angle * 180/Math.PI), outer_radius * Math.sin(start_angle * 180/Math.PI)];
var pointB = [outer_radius * Math.cos(end_angle * 180/Math.PI), outer_radius * Math.sin(end_angle * 180/Math.PI)];
var pointC = [inner_radius * Math.cos(end_angle * 180/Math.PI), inner_radius * Math.sin(end_angle * 180/Math.PI)];
var pointD = [inner_radius * Math.cos(start_angle * 180/Math.PI), inner_radius * Math.sin(start_angle * 180/Math.PI)];
이 문제를 해결해 주시겠습니까?
도움 주셔서 감사합니다.
대단히 감사합니다. 그것은 일을한다;) – Manitoba