Functions / clip
clip(object)
clip(jCanvaScript object)
clip( )

clip(jCanvaScript object)
return: object
A clipping path is like a normal canvas shape but it acts as a mask to hide unwanted parts of shapes. This is visualized below. The circle is our clipping path. Everything that falls outside of this path won't get drawn on the canvas.
Code
<script type="text/javascript">
	function onload_1(idCanvas)
	{
		jc.start(idCanvas);
		var clip=jc.circle(125,130,50);
		jc.rect(0,0,125,130,'#00FFFF',1)
			.clip(clip);
		jc.start(idCanvas);
	}
</script>
<canvas id="canvas_1" width="250px" height="265px">
</canvas>
View
clip( )
return: clip object
Code
<script type="text/javascript">
	function start_2(idCanvas)
	{
		jc('#myRect_2')
			.clip()
			.animate({x:0},1000);
	}
	function stop_2(idCanvas)
	{
		jc('#myRect_2')
			.clip()
			.animate({x:125},1000);
	}
	function onload_2(idCanvas)
	{
		jc.start(idCanvas,true);
		var clip=jc.circle(125,130,50);
		jc.rect(0,0,125,130,'#00FFFF',1)
			.clip(clip)
			.id('myRect_2');
	}
</script>
<canvas id="canvas_2" width="250px" height="265px">
</canvas>
View