summaryrefslogtreecommitdiffstats
path: root/examples/simple/Spiro.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/simple/Spiro.qml')
-rw-r--r--examples/simple/Spiro.qml9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/simple/Spiro.qml b/examples/simple/Spiro.qml
index 22c93e9..8c15f45 100644
--- a/examples/simple/Spiro.qml
+++ b/examples/simple/Spiro.qml
@@ -16,14 +16,21 @@ Canvas {
onPositionChanged: { draw(); }
}
+ onInit: {
+ draw();
+ }
+
function draw() {
var ctx = getContext();
+ ctx.save();
+ ctx.fillStyle = "white"
+ ctx.fillRect(0,0,width, height);
ctx.strokeStyle = color;
ctx.translate((width/2), (height/2));
ctx.rotate(mousearea.mouseY/width)
drawSpirograph(ctx,20*(2)/(1),-8*(3)/(1),mousearea.mouseX/2);
ctx.globalAlpha = 0.5;
- drawSpirograph(ctx,20*(2)/(1),-8*(3)/(1),mousearea.mouseX/2 -10);
+ ctx.restore();
}
function drawSpirograph(ctx,R,r,O){