****编辑***我已经找到了问题,我的下一个问题是,为什么如果我改变第一个X点并将其他人保持为0,我得到了我想要的渐变效果?
/*First declare your varabiles, you can use date or datetime, or even var only after using dateadd the format will change */
Declare @CTCStartDate date
Declare @CTCEndDate date
/* Now define your initial values, you may want to have these by a SSRS report or other program */
Set @CTCStartDate = '2015-01-01'
Set @CTCEndDate = '2015-11-11'
/* See the inital values */
Select @CTCStartDate as InitialStartDT, @CTCEndDate as InitialEndDT
/* Increment the year by the number you desire, even this can be a variable */
Set @CTCEndDate = DATEADD(YYYY,1, @CTCEndDate)
Set @CTCStartDate = DATEADD(YYYY,1, @CTCStartDate)
/* See the final results */
Select @CTCStartDate as StartDT, @CTCEndDate as EndDT
答案 0 :(得分:1)
您必须手动创建一个。另一种方法是将其渲染到离屏画布,然后将该画布用作CreateJS的图像。
快速创建圆锥渐变的方法:
var ctx = c.getContext("2d"),
radius1 = 110, // inner radius
radius2 = 150, // outer radius
gap = Math.ceil(radius2 * 2 * Math.PI / 360); // gap between each degree
for(var a = 360; a--;) {
ctx.setTransform(1,0,0,1,150,150); // 150=center (x,y)
ctx.rotate(a / 180 * Math.PI); // current angle
ctx.fillStyle = "hsl(" + a + ",100%,50%)"; // color using HSL based on angle
ctx.fillRect(radius1, 0, radius2 - radius1, gap); // fill a segment
}
<canvas id=c height=300></canvas>