0
저는 fabric js를 사용하고 있으며 그라디언트 색상을 사용해야합니다.Fabric JS 그래디언트 색상
직물 JS 바이올린 Fabric link
참조 캔버스 구배 Reference Gredient link
정상 캔버스를 사용하는 것과 같이 경사를 달성하기 위해 원단 JS 날 가이드주세요.
Fabric JS :+Snap of code
rect.setGradient('fill', {
x1: 0,
y1: -rect.height,
x2: rect.width,
y2: rect.height,
colorStops: {
0: "black",
0.5: "red",
1: "blue"
}
});
Normal Canvas Code :
var grd=ctx.createLinearGradient(45,50,170,90);
grd.addColorStop(0,"black");
grd.addColorStop(0.5,"red");
grd.addColorStop(1,"blue");
ctx.fillStyle=grd;
ctx.fillRect(20,20,150,100);
메이크업의 jsfiddle 라이브에서 작업 데모 우리가 이미 여기에 공유 다시 패브릭 JS 공유를 확인하는 예를 링크 – Innodel
로 알려 : http://jsfiddle.net/ashishbhatt/e425a3ew/ 참조 : http://jsfiddle.net/ashishbhatt/7x4q91kj/ – ashishbhattb
당신은 완벽한 방법으로 가고 있습니다. 무엇보다 문제가 있습니까? – Innodel