fixed kaleidoscope filter spelling

This commit is contained in:
Eric Rowell
2014-01-05 13:32:50 -08:00
parent 09aaa44e07
commit 193b9d0970
5 changed files with 454 additions and 3 deletions

View File

@@ -96,7 +96,7 @@
<script src="unit/filters/Emboss-test.js"></script>
<script src="unit/filters/Solarize-test.js"></script>
<script src="unit/filters/Ripple-test.js"></script>
<script src="unit/filters/Kalidescope-test.js"></script>
<script src="unit/filters/Kaleidoscope-test.js"></script>
<!--=============== functional tests ================-->

View File

@@ -2948,7 +2948,7 @@ suite('Node', function() {
assert.equal(circle._cache.canvas.scene.getContext().getTrace(), 'save();translate(74,74);beginPath();arc(0,0,70,0,6.283,false);closePath();fillStyle=green;fill();lineWidth=4;strokeStyle=black;stroke();restore();');
});
test.only('show cache border', function(){
test('show cache border', function(){
var stage = addStage();
var layer = new Kinetic.Layer();
var group = new Kinetic.Group();

View File

@@ -0,0 +1,137 @@
suite('Kaleidoscope', function() {
// ======================================================
test('basic', 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,
draggable: true
});
layer.add(darth);
stage.add(layer);
darth.cache();
darth.filters([Kinetic.Filters.Kaleidoscope]);
darth.kaleidoscopeSides(9);
assert.equal(darth.kaleidoscopeSides(), 9);
assert.equal(darth._filterUpToDate, false);
layer.draw();
assert.equal(darth._filterUpToDate, true);
darth.kaleidoscopeSides(16);
assert.equal(darth.kaleidoscopeSides(), 16);
assert.equal(darth._filterUpToDate, false);
layer.draw();
assert.equal(darth._filterUpToDate, true);
done();
};
imageObj.src = 'assets/lion.png';
});
// ======================================================
test('tween offset', 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,
draggable: true
});
layer.add(darth);
stage.add(layer);
darth.cache();
darth.filters([Kinetic.Filters.Kaleidoscope]);
darth.kaleidoscopeSides(5);
darth.kaleidoscopeOffset(0);
layer.draw();
var tween = new Kinetic.Tween({
node: darth,
duration: 4.0,
kaleidoscopeOffset: 64,
//rippleSize: 64,
easing: Kinetic.Easings.EaseInOut
});
darth.on('mouseover', function() {
tween.play();
});
darth.on('mouseout', function() {
tween.reverse();
});
done();
};
imageObj.src = 'assets/lion.png';
});
// ======================================================
test('tween sides', 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,
draggable: true
});
layer.add(darth);
stage.add(layer);
darth.cache();
darth.filters([Kinetic.Filters.Kaleidoscope]);
darth.kaleidoscopeSides(1);
darth.kaleidoscopeOffset(0);
layer.draw();
var tween = new Kinetic.Tween({
node: darth,
duration: 2.0,
kaleidoscopeSides: 32,
easing: Kinetic.Easings.EaseInOut
});
darth.on('mouseover', function() {
tween.play();
});
darth.on('mouseout', function() {
tween.reverse();
});
done();
};
imageObj.src = 'assets/cropped-darth.jpg';
});
});