mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
Merge branch 'master' of https://github.com/Ziriax/KineticJS
Fixed bug #527 - filters and cropping are now friends.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
suite('Blur', function() {
|
||||
// ======================================================
|
||||
test('basic blur', function() {
|
||||
test('basic blur', function(done) {
|
||||
var stage = addStage();
|
||||
|
||||
var imageObj = new Image();
|
||||
@@ -21,12 +21,14 @@ suite('Blur', function() {
|
||||
darth.setFilterRadius(10);
|
||||
layer.draw();
|
||||
|
||||
done();
|
||||
};
|
||||
imageObj.src = 'assets/darth-vader.jpg';
|
||||
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('tween blur', function() {
|
||||
test('tween blur', function(done) {
|
||||
var stage = addStage();
|
||||
|
||||
var imageObj = new Image();
|
||||
@@ -49,7 +51,7 @@ suite('Blur', function() {
|
||||
|
||||
var tween = new Kinetic.Tween({
|
||||
node: darth,
|
||||
duration: 5.0,
|
||||
duration: 2.0,
|
||||
filterRadius: 0,
|
||||
easing: Kinetic.Easings.EaseInOut
|
||||
});
|
||||
@@ -62,12 +64,14 @@ suite('Blur', function() {
|
||||
tween.reverse();
|
||||
});
|
||||
|
||||
done();
|
||||
|
||||
};
|
||||
imageObj.src = 'assets/darth-vader.jpg';
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('crop blur', function() {
|
||||
test('crop blur', function(done) {
|
||||
var stage = addStage();
|
||||
|
||||
var imageObj = new Image();
|
||||
@@ -78,7 +82,7 @@ suite('Blur', function() {
|
||||
x: 10,
|
||||
y: 10,
|
||||
image: imageObj,
|
||||
crop: {x:48, y:48, width:256, height:256},
|
||||
crop: {x:128, y:48, width:256, height:128},
|
||||
draggable: true
|
||||
});
|
||||
|
||||
@@ -89,6 +93,52 @@ suite('Blur', function() {
|
||||
darth.setFilterRadius(10);
|
||||
layer.draw();
|
||||
|
||||
done();
|
||||
|
||||
};
|
||||
imageObj.src = 'assets/darth-vader.jpg';
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('crop tween blur', function(done) {
|
||||
var stage = addStage();
|
||||
|
||||
var imageObj = new Image();
|
||||
imageObj.onload = function() {
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
darth = new Kinetic.Image({
|
||||
x: 10,
|
||||
y: 10,
|
||||
image: imageObj,
|
||||
crop: {x:128, y:48, width:256, height:128},
|
||||
draggable: true
|
||||
});
|
||||
|
||||
layer.add(darth);
|
||||
stage.add(layer);
|
||||
|
||||
darth.setFilter(Kinetic.Filters.Blur);
|
||||
darth.setFilterRadius(100);
|
||||
layer.draw();
|
||||
|
||||
var tween = new Kinetic.Tween({
|
||||
node: darth,
|
||||
duration: 2.0,
|
||||
filterRadius: 0,
|
||||
easing: Kinetic.Easings.EaseInOut
|
||||
});
|
||||
|
||||
darth.on('mouseover', function() {
|
||||
tween.play();
|
||||
});
|
||||
|
||||
darth.on('mouseout', function() {
|
||||
tween.reverse();
|
||||
});
|
||||
|
||||
done();
|
||||
|
||||
};
|
||||
imageObj.src = 'assets/darth-vader.jpg';
|
||||
});
|
||||
|
Reference in New Issue
Block a user