How I can change canvas to svg? -
function ballitemrenderer() { this.canvas = null; this.graphics = this.canvas.getcontext("2d"); this.stroke; this.fill; this.cubedepth = 0; this.cubeangleratio = 0; this.draw = function(x, y, width, height) { var g = this.graphics; if(g) { if(this.stroke && this.stroke.color) g.strokestyle = graphicsutils.color2rgba(this.stroke.color, this.stroke.alpha); if(this.stroke && this.stroke.weight) g.linewidth = this.stroke.weight; else g.linewidth = 1; var rad = width * 0.5; var tx = this.cubeangleratio * rad * 0.5; var radgrad = g.createradialgradient(x+rad-tx, y+rad-tx, 1, x+rad, y+rad, rad); var alpha = isobject(this.fill) ? this.fill.alpha : 1; radgrad.addcolorstop(0, "rgba(255,255,255," + alpha + ")"); radgrad.addcolorstop(1, graphicsutils.adjustbrightness(this.fill, 0)); g.fillstyle = radgrad; g.beginpath(); g.arc(x+rad, y+rad, rad, 0, math.pi*2, true); g.fill(); if(this.stroke && this.stroke.weight) g.stroke(); } } }
i'm trying change canvas svg. difficult me. source works item render. how can change canvas svg? please help.. need sample..
use a circle
element (example) , a radialgradient
element (example). you'll need use dom create , manipulate appropriate elements.
Comments
Post a Comment