Here is the code.
<canvas width="300" height="300" debug="false" >
<include href="" />
<class name="circle" extends="drawview" >
<attribute name="circlecolor" value="white"/>
<attribute name="r" value="100"/>
<attribute name="tooltip" value="tooltip"/>
<tooltip text="tooltip"/>
<method event="oninit">
this.redraw();
</method>
<method event="onr">
this.redraw();
</method>
<method name="redraw" ><![CDATA[
this.clear();
this.beginPath ();
this.moveTo(x+r, y);
var a = Math.tan(22.5 * Math.PI/180);
for (var angle = 45; angle<=360; angle += 45) {
// endpoint:
var endx = r* Math.cos(angle*Math.PI/180);
var endy = r*Math.sin(angle*Math.PI/180);
// control:
// (angle-90 is used to give the correct sign)
var cx =endx + r*a* Math.cos((angle-90)*Math.PI/180);
var cy =endy + r*a*Math.sin((angle-90)*Math.PI/180);
this.quadraticCurveTo(cx+x, cy+y, endx+x, endy+y);
}
var g = this.createLinearGradient(0, 0, 8, x+r, y+r, 0)
this.globalAlpha = 1;
g.addColorStop(0, 0xffffff);
this.globalAlpha = 0;
g.addColorStop(1, this.circlecolor);
this.fillStyle = g;
this.fill()
this.globalAlpha = 1;
this.linewidth= 5;
this.stroke();
]]>
</method>
</class>
<button>foo
<tooltip text="foobar"/>
</button>
<circle r="50" x="50" y="50" circlecolor="blue" tooltip="footip">
<tooltip text="foobar"/>
</circle>
</canvas>
Thanks!
Birch
_______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
