created _getFillType utility to help manage fill type objects. You can now dynamically switch between different fill types, including colors, linear gradients, radial gradients, and patterns

This commit is contained in:
ericdrowell
2012-09-25 15:57:57 -07:00
parent ff926b34af
commit d4734ba33a
6 changed files with 300 additions and 223 deletions

View File

@@ -1786,7 +1786,7 @@ Test.prototype.tests = {
};
imageObj.src = '../assets/darth-vader.jpg';
},
'SHAPE - set image fill to color then image': function(containerId) {
'SHAPE - set image fill to color then image then linear gradient then back to image': function(containerId) {
var imageObj = new Image();
imageObj.onload = function() {
var stage = new Kinetic.Stage({
@@ -1817,7 +1817,27 @@ Test.prototype.tests = {
test(circle.getFill().repeat === 'no-repeat', 'circle fill repeat should be no-repeat');
test(circle.getFill().offset.x === -200, 'circle fill offset x should be -200');
test(circle.getFill().offset.y === -70, 'circle fill offset y should be -70');
circle.setFill({
start: {
x: -35,
y: -35
},
end: {
x: 35,
y: 35
},
colorStops: [0, 'red', 1, 'blue']
});
test(circle.getFill().image === undefined, 'circle fill image should be undefined');
circle.setFill({
image: imageObj,
repeat: 'no-repeat',
offset: [-200, -70]
});
layer.draw();
};
imageObj.src = '../assets/darth-vader.jpg';
@@ -4607,6 +4627,15 @@ Test.prototype.tests = {
layer.draw();
},
'STAGE - test stage.getStage()': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
console.log(stage.getStage());
},
'LAYERING - move blue layer on top of green layer with moveToTop': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,