Re posting the question again.
I didn’t explain the question properly before so sorry about that.
Hope this will make up for it
I am planning to make a plugin for Kineticjs.
Now I’m not an expert at this so need some help.
I saw few examples online but they didn’t help much.
Some Jquery tutorias that use the DOM elements and you can write your function to alter the behaviour or add functionality and all.
Like for making a jquery plugin we can do something like:
(function($) {
$.fn.nameofthefunction = function() {
// Add plugin code here
here I can manipulate dom elements and all..
};
})(jQuery);
What I need is to use inbuilt functions of kinetic.js make a plugin accordingly..
Kinetic.js is a HTML5 canvas library.
SO if I do something like
var image = new Kinetic.Image({
x: 325 - 45,
y: 145 - 83,
image: beeObj,
draggable: true,
});
here “draggable:true” makes the image draggable
here is one example that is making the image resizable:
http://www.html5canvastutorials.com/labs/html5-canvas-drag-and-drop-resize-and-invert-images/
I want to make a plugin using this example so that the user can just do something like resize:true or image.resize();
and the image/shape becomes resizable.
Hope I’m able to explain myself
hmm i guess what you want to do , is to have options for your plugin .. that is achieved by
now when some body call your plugin he will pass some options if he like , other wise the plugin will use the default options (eg
other_optuionwill be'value')like so
i guess you should read more about jquery plugin development..
one place i would recommend is youtube 😉 for fast learning