if (frame > totalPaths)
return;
-
- ctx.globalCompositeOperation = "source-over";
- ctx.clearRect(0, 0, 800, 800);
-
- ctx.strokeColor = Qt.rgba(133, 133, 133,1);
- ctx.lineWidth = 1;
+ console.log(frame);
+ ctx.reset();
+ ctx.globalCompositeOperation = "source-over";
+ ctx.fillStyle = "rgba(0,0,0,0)";
+ //ctx.fillRect(0, 0, 600, 600);
+ ctx.fillRect(0, 0, 1900, 1200);
+ ctx.strokeColor = Qt.rgba(133, 133, 133,1);
+ ctx.lineWidth = 1;
+ //ctx.translate(200, 200);
+ ctx.translate(750, 350);
+ ctx.scale(2,2);
for (var i = 0; i < frame; i++) {
- console.log("draw frame:" + i + " fill:" + tiger[i].fill + " stroke:" + tiger[i].stroke + " path:" + tiger[i].path + " width:" + tiger[i].width);
if (tiger[i].width != undefined)
ctx.lineWidth = tiger[i].width;
ctx.fill();
}
- //if (tiger[i].stroke != undefined) {
- // ctx.strokeStyle = tiger[i].stroke;
+ if (tiger[i].stroke != undefined) {
+ ctx.strokeStyle = tiger[i].stroke;
ctx.stroke();
- // }
-
- }
+ }
+ }
}
Canvas {
id:canvas
- width:800
- height:800
+ width:1900
+ height:1150
property int frame:0
Timer {
repeat:true
- interval:10
+ interval:100
running:true
onTriggered: {
- frame++;
- if (frame > Tiger.tiger.length)
- frame = 0;
- Tiger.draw(canvas.getContext(), canvas.frame);
+ canvas.frame++;
+ if (canvas.frame > Tiger.tiger.length) {
+ canvas.frame = 0;
+ } else {
+ Tiger.draw(canvas.getContext(), canvas.frame);
+ }
}
}
-
- /*onDrawRegion:{
+/*
+ onDrawRegion:{
Tiger.draw(context, canvas.frame);
- }*/
+ }
+Text {
+ anchors.top : parent.top
+ font.pixelSize : 30
+ text: "drawing path:" + canvas.frame + "/" + Tiger.tiger.length;
+}
+*/
}