HTML tuvali createRadialGradient() Yöntemi
Örnek
Bir dikdörtgen çizin ve radyal/dairesel bir eğimle doldurun:
JavaScript:
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var grd = ctx.createRadialGradient(75, 50, 5, 90, 60, 100);
grd.addColorStop(0, "red");
grd.addColorStop(1, "white");
// Fill with gradient
ctx.fillStyle = grd;
ctx.fillRect(10, 10, 150, 100);
Tarayıcı Desteği
Tablodaki sayılar, yöntemi tam olarak destekleyen ilk tarayıcı sürümünü belirtir.
Method | |||||
---|---|---|---|---|---|
createRadialGradient() | Yes | 9.0 | Yes | Yes | Yes |
Tanım ve Kullanım
createRadialGradient() yöntemi, radyal/dairesel bir degrade nesnesi oluşturur.
Degrade, dikdörtgenleri, daireleri, çizgileri, metni vb. doldurmak için kullanılabilir.
İpucu: Bu nesneyi konturStyle veya fillStyle özelliklerinin değeri olarak kullanın.
İpucu: Farklı renkleri ve renklerin degrade nesnesinde nereye konumlandırılacağını belirtmek için addColorStop() yöntemini kullanın.
JavaScript sözdizimi: | bağlam .createRadialGradient( x0,y0,r0,x1,y1,r1 ); |
---|
Parametre Değerleri
Parameter | Description |
---|---|
x0 | The x-coordinate of the starting circle of the gradient |
y0 | The y-coordinate of the starting circle of the gradient |
r0 | The radius of the starting circle |
x1 | The x-coordinate of the ending circle of the gradient |
y1 | The y-coordinate of the ending circle of the gradient |
r1 | The radius of the ending circle |
❮ HTML Kanvas Referansı