求解答obj.alpha+=speed為什么不能寫成obj.alpha+ speed
這個長度運動里面
obj.style.width=obj.offsetWidth+speed+'px';
為什么不能寫成:
obj.offsetWidth+=speed;
obj.style.width=obj.offsetWidth+'px';
而透明度變化里面
obj.alpha+=speed;
obj.style.opacity=obj.alpha/100;
不能寫成
obj.style.opacity=(obj.alpha+speed)/100;
這是算法方面的東西嘛?一臉懵逼。
2016-09-10
a=a+b?????? a+=b 這是運算公式
obj.style.width=obj.offsetWidth+speed+'px';這是給width賦值的意思