mirror of
https://github.com/konvajs/konva.git
synced 2026-03-03 16:58:33 +08:00
added more cache and filter tests
This commit is contained in:
@@ -83,4 +83,69 @@ suite('Manual', function() {
|
||||
|
||||
tween.play();
|
||||
});
|
||||
|
||||
// ======================================================
|
||||
test('blur and tween spline', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var spline = new Kinetic.Line({
|
||||
points: [
|
||||
73, 160,
|
||||
340, 23,
|
||||
500, 109,
|
||||
300, 109
|
||||
],
|
||||
stroke: 'blue',
|
||||
strokeWidth: 10,
|
||||
lineCap: 'round',
|
||||
lineJoin: 'round',
|
||||
draggable: true,
|
||||
tension: 1
|
||||
});
|
||||
|
||||
layer.add(spline);
|
||||
stage.add(layer);
|
||||
|
||||
spline.cache({
|
||||
width: stage.width(),
|
||||
height: stage.height()
|
||||
});
|
||||
|
||||
spline.filters([Kinetic.Filters.Blur]).blurRadius(40);
|
||||
layer.draw();
|
||||
|
||||
layer.on('beforeDraw', function() {
|
||||
spline.cache({
|
||||
width: stage.width(),
|
||||
height: stage.height()
|
||||
});
|
||||
});
|
||||
|
||||
var tween = new Kinetic.Tween({
|
||||
node: spline,
|
||||
duration: 2,
|
||||
//x: 100,
|
||||
|
||||
points: [
|
||||
200, 160,
|
||||
200, 23,
|
||||
500, 109,
|
||||
100, 10
|
||||
],
|
||||
blurRadius: 0,
|
||||
easing: Kinetic.Easings.BackEaseOut,
|
||||
yoyo: false
|
||||
});
|
||||
|
||||
// stage.getContent().addEventListener('mouseover', function() {
|
||||
// tween.play();
|
||||
// });
|
||||
|
||||
// stage.getContent().addEventListener('mouseout', function() {
|
||||
// tween.reverse();
|
||||
// });
|
||||
|
||||
tween.play();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user