废话不多说,直接上代码
// fadeIn/fadeOut
PropertyAnimation {
id:animFadeIn
target: root
duration: root.duration
easing.type: root.easingType
property: 'opacity';
from: 0;
to: root.innerOpacity
}
PropertyAnimation {
id: animFadeOut
target: root
duration: root.duration
easing.type: root.easingType
property: 'opacity';
from: root.innerOpacity;
to: 0
}
// width
PropertyAnimation {
id: animWidthIncrease
target: root
duration: root.duration
easing.type: root.easingType
property: 'width';
from: 0;
to: root.innerWidth
}
PropertyAnimation {
id: animWidthDecrease
target: root
duration: root.duration
easing.type: root.easingType
property: 'width';
from: root.innerWidth;
to: 0
}
// height
PropertyAnimation {
id: animHeightIncrease
target: root
duration: root.duration
easing.type: root.easingType
property: 'height';
from: 0;
to: root.innerHeight
}
PropertyAnimation {
id: animHeightDecrease
target: root
duration: root.duration
easing.type: root.easingType
property: 'height';
from: root.innerHeight;
to: 0
}
// size(如何控制size动画的中心点)
PropertyAnimation {
id: animBig
target: root
duration: root.duration
easing.type: root.easingType
property: 'scale';
from: 0;
to: 1
}
PropertyAnimation {
id: animSmall
target: root
duration: root.duration
easing.type: root.easingType
property: 'scale';
from: 1;
to: 0
}
// fly in
PropertyAnimation {
id: animInRight
target: root
duration: root.duration
easing.type: root.easingType
property: 'x';
from: -root.innerWidth;
to: root.innerX
}
PropertyAnimation {
id: animInLeft
target: root
duration: root.duration
easing.type: root.easingType
property: 'x';
from: getRoot(root).width;
to: root.innerX
}
PropertyAnimation {
id: animInUp
target: root
duration: root.duration
easing.type: root.easingType
property: 'y';
from: getRoot(root).height;
to: root.innerY
}
PropertyAnimation {
id: animInDown
target: root
duration: root.duration
easing.type: root.easingType
property: 'y';
from: -root.innerHeight
to: root.innerY
}
// fly out
PropertyAnimation {
id: animOutRight
target: root
duration: root.duration
easing.type: root.easingType
property: 'x';
from: root.innerX;
to: getRoot(root).width
}
PropertyAnimation {
id: animOutLeft
target: root
duration: root.duration
easing.type: root.easingType
property: 'x';
from: root.innerX;
to: -root.width
}
PropertyAnimation {
id: animOutUp
target: root
duration: root.duration
easing.type: root.easingType
property: 'y';
from: root.innerY;
to: -root.height
}
PropertyAnimation {
id: animOutDown
target: root
duration: root.duration
easing.type: root.easingType
property: 'y';
from: root.innerY
to: getRoot(root).height
}
属性描述
// 公有属性
property bool showMask : false;
property string animationType : 'none';
property int duration : 500
property int easingType : Easing.OutBounce
// 私有属性
property int innerX;
property int innerY;
property int innerWidth;
property int innerHeight;
property double innerOpacity;