English 中文(简体)
传真5 - can
原标题:HTML5 - canvas createLinearGradient horizontal

我怎么能创造从左边到右边的血管梯度,而不是从上到下。

var lingrad = ctx.createLinearGradient(0,0,0,150);
 lingrad.addColorStop(0,  #00ABEB );
 lingrad.addColorStop(0.5,  #fff );
 lingrad.addColorStop(0.5,  #66CC00 );
 lingrad.addColorStop(1,  #fff );

 ctx.fillStyle = lingrad;
 ctx.fillRect(10,10,780,130);

从头到尾,我需要做什么来改变从左边到右边的转变?

问题回答

createLinear Gradient (x0, y0, x1, y1) 油漆线从(x0, y0)到(x1, y1)。

你的行程目前从0到0,150。 换言之,它正在直截了当的150个餐厅。

与之交流,直截了150个餐厅。

var lingrad = ctx.createLinearGradient(0,0,150,0);




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签