61,110
社区成员
发帖
与我相关
我的任务
分享
<div id="dam_button">
<button>点击重新计算</button>
</div>
#dam_button{
position:absolute;
top:360;
left:80;
display:none;
}
function dam_button_show() //修改该按钮的属性
{
var ui = document.getElementById("dam_button");
ui.style.display=" ";
}
on(dambutton,"click",function()
{
dambox.play(); //动画1
damtext.play(); //动画2
dam_button.play(); //动画3
dam_button_show(); //修改该按钮的属性
}
function dam_button_show() //修改该按钮的属性
{
var ui = document.getElementById("dam_button");
ui.style.display=" ";
}
难道是因为我用的dojo的原因?不应该吧,我发个全的
<script>
require
(
["dojo/_base/fx", "dojo/fx", "dojo/fx/easing", "dojo/dom-style", "dojo/dom", "dojo/aspect", "dojo/on", "dojo/domReady!"],
function(baseFx, fx, easing, domStyle, dom, aspect, on)
{
showdam=dom.byId("showdam");
dambutton=dom.byId("dambutton");
var dambox = baseFx.animateProperty
(
{
easing:easing.bounceOut,
node:showdam,
properties:
{
left:{start:0,end:30},
top:{start:0,end:200},
width:{start:0,end:290},
height:{start:0,end:420},
},
duration:1000,
}
);
var damtext=baseFx.animateProperty
(
{
easing:easing.bounceOut,
node:dam,
duration:1000,
properties:
{
fontSize:{start:0,end:19},
left:{start:0,end:15},
top:{start:0,end:15},
backgroundColor:{start:"#000",end:"#FFA07A"},
width:260,
height:380,
},
}
);
var dam_button=baseFx.animateProperty
(
{
easing:easing.bounceOut,
node:dam_button,
duration:1000,
properties:
{
left:{start:0,end:80},
top:{start:0,end:360},
width:{start:0,end:200},
height:{start:0,end:50},
},
}
);
function dam_button_show() //修改该按钮的属性
{
var ui = document.getElementById("dam_button");
ui.style.display=" ";
}
on(dambutton,"click",function()
{
dam_button_show(); //修改该按钮的属性
dambox.play(); //动画1
damtext.play(); //动画2
dam_button.play(); //动画3
}
);
}
);
</script>
<div class="showdam" id="showdam"><!--显示伤害的盒子-->
<div id="dam"></div> <!-- 下来的顺序是盒子移动到正确的位置,并且随之变大,然后文字填充到盒子内-->
<div id="dam_button">
<button>点击重新计算</button>
</div>
</div>
class="showdam"在初始的情况下,高和宽都是0(变相起到隐藏作用)。
id为dam_button的块内有一个按钮,我将这个按钮初始设置为隐藏。
④这个展示一些信息,由于我需要在点击按钮后,触发一些事件(把这个再隐藏起来)。因此,我需要切换这个按钮的display属性。
就是这样~
目前若是不加入display属性,其初始位置是有问题的,动画后的位置是正确的。
但由于初始位置不重要,因此我才加入display属性,希望其在初始的情况下不显示,动画的时候将class="showdam"的显示,顺便更改这个按钮的display属性。
其实应该也有其他方法能解决这个问题,不过我搞懂这个是为了学习这个知识,所以只能死磕了。