KineticJS
KineticJS copied to clipboard
mutiple reload image on ios12 platform will be crash and the image will not show
// version=5.1.1 var urls = [ "imge1", "imge2", "imge3", "imge1", "imge2", "imge3", ] var echo =0; var stage; init(); $("#ontainer").on("touchstart", function(e) { }); $("#ontainer").on("touchmove", function(e) { }); $("#ontainer").on("touchend", function(e) { init(); }); function init() { var imageUrl = urls[echo]; var stage = new Kinetic.Stage({ container: 'container', width: 729, height: 294 }); var layer = new Kinetic.Layer(); var imageObj = new Image(); imageObj.src = imageUrl; imageObj.onload = function() { setTimeout(function(){ var yoda = new Kinetic.Image({ x: 200, y: 200, image: imageObj, width: 106, height: 118 }); layer.add(yoda); stage.add(layer); layer.draw();
$("#test").empty();
$("#test").append(imageObj);
// $("#img1").attr("src", imageUrl);
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d')
ctx.drawImage(imageObj, 0, 0)
echo += 1;
if (echo > 11) {
echo = 0;
}
}, 1000);
};