mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 10:47:59 +08:00
added functional test that tests all of the transition easing functions
This commit is contained in:
@@ -27,6 +27,39 @@ Test.prototype.tests = {
|
||||
easing: 'bounce-ease-out'
|
||||
});
|
||||
},
|
||||
'TRANSITION - all transition types': function(containerId) {
|
||||
document.getElementById(containerId).style.height = '300px';
|
||||
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 300
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var easings = ['linear', 'ease-in', 'ease-out', 'ease-in-out', 'back-ease-in', 'back-ease-out', 'back-ease-in-out', 'elastic-ease-in', 'elastic-ease-out', 'elastic-ease-in-out', 'bounce-ease-out', 'bounce-ease-in', 'bounce-ease-in-out', 'strong-ease-in', 'strong-ease-out', 'strong-ease-in-out'];
|
||||
for(var n = 0; n < easings.length; n++) {
|
||||
var rect = new Kinetic.Rect({
|
||||
x: 10,
|
||||
y: 10 + (n * 200 / easings.length),
|
||||
width: 100,
|
||||
height: 10,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 2
|
||||
});
|
||||
|
||||
layer.add(rect);
|
||||
|
||||
rect.transitionTo({
|
||||
duration: 2,
|
||||
width: 500,
|
||||
easing: easings[n]
|
||||
});
|
||||
}
|
||||
|
||||
stage.add(layer);
|
||||
},
|
||||
'TRANSITION - transition callback': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
Reference in New Issue
Block a user