同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
当组件通过id属性标识后,可以使用该id获取组件对象并调用相关组件方法。
|
通过animate(keyframes, options)方法获得animation对象。该对象支持动画属性,动画方法和动画事件。重复多次调用animate方法时,采用replace策略,最后一次调用时传入的参数生效。
keyframes
用于设置动画样式属性的对象列表。Style类型说明请见表1 Style类型说明。 |
表 1 Style类型说明
|
options
描述动画的时间曲线,支持类型见表3 easing有效值说明。 |
|||
表 2 easing有效值说明
返回值
animation对象支持的属性:
|
||
animation对象支持的方法:
animation对象支持的事件:
示例代码:
// xxx.js
import prompt from '@system.prompt';
export default {
data : {
animation:'',
},
onInit() {
},
onShow() {
var options = {
duration: 1500,
easing: 'friction',
delay: 500,
fill: 'forwards',
iterations: 2,
};
var frames = [
{transform: {translate: '-120px -0px'}, opacity: 0.1, offset: 0.0},
{transform: {translate: '120px 0px'}, opacity: 1.0, offset: 1.0}
];
this.animation = this.$element('idName').animate(frames, options);
// handle finish event
this.animation.onfinish = function() {
prompt.showToast({
message: "The animation is finished."
});
};
// handle cancel event
this.animation.oncancel = function() {
prompt.showToast({
message: "The animation is canceled."
});
};
// handle repeat event
this.animation.onrepeat = function() {
prompt.showToast({
message: "The animation is repeated."
});
};
},
start() {
this.animation.play();
},
cancel() {
this.animation.cancel();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。