I am new to use kinetic js, and I think that it is so good library, the problem is the resolution of the elements, I know that kinetic js doesn't use svg, but the resolution is horrible, I am creating circles and sample shape with animations, but these look like poor images and I don't want that. Somebody know a solution or definitely it is impossible to change the resolution ?
For example I create the elements like this:
var circle = new Kinetic.Circle({
x: this.stage.getWidth() / 2,
y: this.stage.getHeight() / 2 + 10,
radius: radius,
fill: 'red',
stroke: 'black',
strokeWidth: 2,
draggable: true
});
Can you post an example?
It's possible that your animation is trying to draw frames faster than they can be properly rendered--causing ghosts/blurs. If you throttle down your framerate, is the "horribleness" reduced?
These static shape results between KineticJS, native-Canvas and SVG look the same to me.
Here's code and a Fiddle: http://jsfiddle.net/m1erickson/pgBv4/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Prototype</title>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.5.1.min.js"></script>
<style>
#container{
border:solid 1px #ccc;
margin-top: 10px;
width:200px;
height:200px;
}
#canvas{ border:1px solid red; }
</style>
<script>
$(function(){
var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
ctx.beginPath();
ctx.arc(100,100,75,0,Math.PI*2,false);
ctx.closePath();
ctx.fillStyle="red";
ctx.strokeStyle="black";
ctx.lineWidth=2;
ctx.fill();
ctx.stroke();
var stage = new Kinetic.Stage({
container: 'container',
width: 200,
height: 200
});
var layer = new Kinetic.Layer();
stage.add(layer);
var circle = new Kinetic.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2 + 10,
radius: 75,
fill: 'red',
stroke: 'black',
strokeWidth: 2,
draggable: true
});
layer.add(circle);
layer.draw();
}); // end $(function(){});
</script>
</head>
<body>
<div id="container"></div>
<canvas id="canvas" width=200 height=200></canvas>
<svg width="200" height="200">
<circle x="100" y="100" r="75" fill="red" stroke="black" stroke-width="2" />
</svg>
</body>
</html>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.