Halaman

Minggu, 17 Maret 2013

Glow.js - SETELAH di sederhanakan


var GlowBenar = new Glow('rgba(0,220,200,1)','#FFFFFF');
var GlowSalah = new Glow('rgba(255,0,255,0.9)','#FFFFFF');


var sudut1 = xybutton[nosoal].sdt1;
var sudut2 = xybutton[klikbtn].sdt2;
var jumlsudut = sudut1+sudut2;
var fsudut = jumlsudut==180;
if(fsudut) GlowBenar.draw()
else GlowSalah.draw()


function Glow(clr1,clr2){
this._x = 483;
this._y = 301;
this._radius = 15;
this._color1 = clr1||'#FFFFFF';
this._color2 = clr2||'#FFFFFF';
//------------
this.draw = function(){
var startAngle
var endAngle
var counterClockwise

startAngle = 0
endAngle   = 360
counterClockwise = true;
ctx.save();
ctx.beginPath();
ctx.moveTo(this._x, this._y);
ctx.arc(this._x, this._y, this._radius, startAngle, endAngle, counterClockwise);
ctx.lineTo(this._x, this._y);
ctx.lineWidth = 2;

var grd = ctx.createRadialGradient(this._x, this._y, 0, this._x, this._y, this._radius);
grd.addColorStop(0, this._color1);
grd.addColorStop(1, this._color2);

ctx.fillStyle = grd;
ctx.fill();
ctx.restore();
}
}

Tidak ada komentar:

Posting Komentar