Library
Functions / layer
layer(idLayer)
layer( )
return: id of jCanvaScript objects layer.
Code
<script type="text/javascript">
function start_1(idCanvas)
{
alert(jc('#myCircle_11')
.layer());
}
function stop_1(idCanvas)
{
alert(jc('#myCircle_12')
.layer());
}
function onload_1(idCanvas)
{
jc.start(idCanvas,true);
jc.circle(45,60,40,'#00FFFF',1)
.id('myCircle_11')
.layer('myLayer_1');
jc.circle(135,60,40,'#00FFFF',1)
.id('myCircle_12');
}
</script>
<canvas id="canvas_1" width="250px" height="132px">
</canvas>
View
layer(string idLayer)
return: object
The method allows to place jCanvaScript object in a layer with some id. If the layer with such id doesn't exist, it will be created in the last initialized canvas.
Code
<script type="text/javascript">
function start_2(idCanvas)
{
jc({layer:'myLayer_2'})
.color('#FF00FF');
}
function stop_2(idCanvas)
{
jc({layer:'myLayer_2'})
.color('#00FFFF');
}
function onload_2(idCanvas)
{
jc.start(idCanvas,true);
jc.circle(45,60,40,'#00FFFF',1)
.layer('myLayer_2');
jc.circle(135,60,40,'#00FFFF',1)
.layer('myLayer_2');
jc.circle(185,60,40,'#00FFFF',1);
}
</script>
<canvas id="canvas_2" width="250px" height="132px">
</canvas>
View