I am new to HTML5. I have to implement such functionality that I want the images to be deleted inside the canvas from the outside, then there are visible borders inside the canvas, and the images can move from one border to another. This is the same as the following link, http://custom.case-mate.com/diy?bypassLandingPage=true
Since the user selects a template on the site and drags images into it. Then it can drag and drop images between borders. please give some solution to implement such functionality.
Here is what I tried
<!DOCTYPE HTML> <html> <head> <style> body { margin: 0px; padding: 0px; } canvas {position:relative; left:150%; border: 10px solid #9C9898; background-color: grey; } </style> <script src="http://www.html5canvastutorials.com/libraries/kinetic-v3.10.0.js"></script> <script> window.onload = function() { var stage = new Kinetic.Stage({ container: "container", width: 300, height: 400, }); var layer = new Kinetic.Layer(); var redLine = new Kinetic.Line({ points: [150, 0, 150, 400], stroke: "white", strokeWidth: 2, }); var blueLine = new Kinetic.Line({ points: [150, 0, 150, 120, 300, 120], stroke: "white", strokeWidth: 2, }); var thirdLine = new Kinetic.Line({ points: [300, 120, 150, 120, 150, 400], stroke: "white", strokeWidth: 2, }); var imageObj = new Image(); imageObj.onload = function() { var image = new Kinetic.Image({ x: stage.getWidth() / 2 - 50, y: stage.getHeight() / 2 - 60, image: imageObj, width: 100, height: 120, }); image.draggable(true); layer.add(image); </script> </head> <body> <div id="container"></div> </body> </html>
source share