Canvas snippets: Difference between revisions

Jump to navigation Jump to search
m
Line 143: Line 143:
.setColor(0,0,1)
.setColor(0,0,1)
.setStrokeLineWidth(2);
.setStrokeLineWidth(2);
</syntaxhighlight>
|-
|}
{| class="wikitable"
|-
! Screenshot !! Code
|-
| [[File:Canvas-openvg-cubicTo.png|thumb|screen shot showing a simple Canvas GUI dialog demonstrating how to use OpenVG-path drawing via Nasal and Canvas (Canvas/OpenVG cubicTo API for drawing curves)]]
| {{Note|This assumes that you are appending this to the snippet shown above.}}
<syntaxhighlight lang="nasal" enclose="div">
var points = [ 60,height-20,
120,height-120,
230,height-100,
];
var track = graph.createChild("path", "track")
.moveTo(10, height/2)
.cubicTo( points )
.setColor(0,1,0)
.setStrokeLineWidth(4);
</syntaxhighlight>
</syntaxhighlight>
|-
|-

Navigation menu