mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 10:47:59 +08:00
refactored filter API so that transitions can hook into the filter controls. Filter transitons are now working. Filters can now also have an unlimited number of parameters. added _applyFilter flag to ensure that new filters are only applied once, when needed, right before a redraw
This commit is contained in:
@@ -52,7 +52,6 @@ Test.Modules.TRANSITION = {
|
||||
easing: 'bounce-ease-out'
|
||||
});
|
||||
},
|
||||
|
||||
'all transition types': function(containerId) {
|
||||
document.getElementById(containerId).style.height = '300px';
|
||||
|
||||
@@ -1438,5 +1437,46 @@ Test.Modules.DRAG_AND_DROP = {
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
'transition gaussian blur filter': function(containerId) {
|
||||
var imageObj = new Image();
|
||||
imageObj.onload = function() {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
darth = new Kinetic.Image({
|
||||
x: 10,
|
||||
y: 10,
|
||||
image: imageObj,
|
||||
draggable: true,
|
||||
filter: Kinetic.Filters.Blur,
|
||||
filterRadius: 20
|
||||
});
|
||||
|
||||
layer.add(darth);
|
||||
stage.add(layer);
|
||||
|
||||
|
||||
darth.on('mouseover', function() {
|
||||
darth.transitionTo({
|
||||
easing: 'ease-in-out',
|
||||
duration: 0.5,
|
||||
filterRadius: 0
|
||||
});
|
||||
});
|
||||
|
||||
darth.on('mouseout', function() {
|
||||
darth.transitionTo({
|
||||
easing: 'ease-in-out',
|
||||
duration: 0.5,
|
||||
filterRadius: 20
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
imageObj.src = '../assets/darth-vader.jpg';
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user