var referto = document.getElementById('Referto');
var stage = new Kinetic.Stage({
container : 'container',
width : 578,
height : 200
});
var layer = new Kinetic.Layer();
var layer2 = new Kinetic.Layer();
var imageObj = new Image();
var imageOver = new Image();
imageObj.onload = function() {
var yoda = new Kinetic.Image({
x : 140,
y : stage.getHeight() / 2 - 59,
image : imageObj,
width : 106,
height : 118,
draggable : true
});
// add the shape to the layer
layer.add(yoda);
// add the layer to the stage
stage.add(layer);
// apply grayscale filter to second image
filteredYoda.applyFilter(Kinetic.Filters.Grayscale, null,
function() {
layer.draw();
});
};
imageObj.src = 'http://www.html5canvastutorials.com/demos/assets/yoda.jpg';
function load() {
imageOver.onload = function() {
var gaga = new Kinetic.Image({
x : 40,
y : stage.getHeight() / 2 - 59,
image : imageOver,
width : 106,
height : 118,
draggable : true
});
// add the shape to the layer
layer2.add(gaga);
// add the layer to the stage
stage.add(layer2);
};
imageOver.src = 'https://twimg0-a.akamaihd.net/profile_images/3221348438/9b0734b7fa0d6576f2d1511ce9f7f5e0.jpeg';
}
//checkboxes
referto.addEventListener('click', function() {
if (this.checked) {
load();
stage.add(layer2);
}
else if (!this.checked) {
layer2.clear();
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.