Mootools 1.3.1:链式动画和同步动画2个元素
Mootools 1.3.1: chain animations and animate 2 elements synchronisly
我想同时给div#w_xxx
和div#w_xxx img
添加动画。
它们应该变大,之后它们应该恢复到原来的宽度和高度。
问题是,mootools同时播放所有动画,所以我看不到动画,我尝试了一些.chain
功能从mootools,但我没有得到它的工作。
我的代码是这样的:
$("w_"+current_item+"").set('morph', {
duration: 1000,
transition: Fx.Transitions.Bounce.easeOut
});
$("w_"+current_item+"").morph({
'opacity': '1',
'width': 366,
'height': 240,
'z-index': '100'
});
$$("div#w_"+current_item+" img").set('morph', {
duration: 1000,
transition: Fx.Transitions.Bounce.easeOut
});
$$("div#w_"+current_item+" img").morph({
'opacity': '1',
'width': 366,
'height': 240,
'z-index': '100'
});
$("w_"+current_item+"").set('morph', {
duration: 1000,
transition: Fx.Transitions.Bounce.easeOut
});
$("w_"+current_item+"").morph({
'opacity': '1',
'width': 183,
'height': 120,
'z-index': '100'
});
$$("div#w_"+current_item+" img").set('morph', {
duration: 1000,
transition: Fx.Transitions.Bounce.easeOut
});
$$("div#w_"+current_item+" img").morph({
'opacity': '1',
'width': 183,
'height': 120,
'z-index': '100'
});
您应该查看MooTools-more: http://mootools.net/docs/more/Fx/Fx.Elements中的Fx.Elements
,它被设计为在统一的计时器上运行多个动画。
// mock your current_item...
var current_item = 1;
var w = document.id("w_" + current_item);
new Fx.Elements($$(w, w.getElement("img")), {
onComplete: function() {
console.log("done");
},
duration: 4000,
transition: Fx.Transitions.Bounce.easeOut,
link: "chain"
}).start({
0: {
'opacity': '1',
'width': 366,
'height': 240,
'z-index': '100'
},
1: {
'opacity': '1',
'width': 183,
'height': 120,
'z-index': '100'
}
}).start({
0: {
opacity: 0
}
});
同样,它支持link: chain,所以你可以链接东西或等待等。
相关文章:
- 音频和动画在javasctipt循环中同步
- 淘汰绑定中的同步动画
- jQuery动画不同步
- 使javascript动画条与动画百分比同步
- JQuery 同步动画不起作用
- 我的css动画和JQuery没有同步
- 每隔几秒钟更改一个元素并与动画同步
- JavaScript动画同步
- 在javascript中同步动画
- React颜色动画同步
- 如何将JavaScript动画与歌曲的节奏同步,而无需构建“音频可视化器”
- Mootools 1.3.1:链式动画和同步动画2个元素
- 同步JQuery动画与计算在一个循环
- 同步css关键帧动画与jQuery setInterval
- 画布动画与视频时间同步
- 同步动画,或在动画的中途点调用
- 西蒙游戏javascript,我如何同步按钮的灯不踩在彼此与动画()和延迟()JQUERY
- 加载和显示多个动画gif在同一时间(同步)与Javascript
- React动画同步
- 动画同步,光标和高亮