mirror of
https://github.com/konvajs/konva.git
synced 2026-01-18 19:51:21 +08:00
transition call back is called using the nodes context. This means that you can access the node with the this keyword
This commit is contained in:
@@ -13,7 +13,8 @@ Test.Modules.TRANSITION = {
|
||||
height: 50,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4
|
||||
strokeWidth: 4,
|
||||
id: 'rect'
|
||||
});
|
||||
|
||||
layer.add(rect);
|
||||
@@ -37,7 +38,8 @@ Test.Modules.TRANSITION = {
|
||||
x: 300,
|
||||
duration: 1,
|
||||
callback: function() {
|
||||
test(rect.getX() === 300, 'rect x is not 300');
|
||||
test(this.getX() === 300, 'rect x is not 300');
|
||||
test(this.getId() === 'rect', 'rect id should be rect');
|
||||
anim.start();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user