当前位置: 首页 > 文档资料 > TweenMax 中文文档 >

.invalidate()

优质
小牛编辑
130浏览
2023-12-01

刷新任何内部记录的开始/结束值,如果您想要重新启动动画而不恢复到以前记录的任何起始值,这将非常有用。
.invalidate()适用于TweenMaxTweenLite

.invalidate()的参数

.invalidate() 示例


    
    
body {
  background-color:#1d1d1d;
  font-family: Signika Negative, sans-serif;
  color:#989898;
  margin:0px;
  font-size:18px;
}
h1, h2, h3 {
  font-family: "Signika Negative", sans-serif;
  margin: 10px 0 10px 0;
  color:#f3f2ef;
  font-weight: 400;
}
h1 { 
  font-size:42px;
}
h2 {
  font-size:24px;
}
h3 {
  font-size:22px;
}
p{
  line-height:22px;
  margin-bottom:16px;  
}
a {
  color: #88ce02;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
#demo {
  height:100%;
  position:relative;
}
.box {
  width:50px;
  height:50px;
  position:relative;
  border-radius:6px;
  margin-top:4px;
  display:inline-block;
  line-height:50px;
  text-align:center;
  color:#333;
  
}
.green{
  background-color:#6fb936;
}
.orange {
  background-color:#f38630;
}
.grey {
  background-color:#989898;
}
button {
  display:inline-block;
  outline: none;
  border: none;
  padding: 8px 14px;
  background: #414141;
  background-image: -webkit-linear-gradient(top, #575757, #414141);
  background-image: -moz-linear-gradient(top, #575757, #414141);
  background-image: -ms-linear-gradient(top, #575757, #414141);
  background-image: -o-linear-gradient(top, #575757, #414141);
  background-image: linear-gradient(to bottom, #575757, #414141);
  text-shadow: 0px 1px 0px #414141;
  -webkit-box-shadow: 0px 1px 0px 414141;
  -moz-box-shadow: 0px 1px 0px 414141;
  box-shadow: 0px 1px 0px 414141;
  color: #ffffff;
  text-decoration: none;
  margin: 0 auto;
  -webkit-border-radius: 4;
  -moz-border-radius: 4;
  border-radius: 4px;
  padding: 12px 25px;
  font-family: "Signika Negative", sans-serif;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  line-height: 18px;
}
button:hover {
  background: #57a818;
  background-image: -webkit-linear-gradient(top, #57a818, #4d9916);
  background-image: -moz-linear-gradient(top, #57a818, #4d9916);
  background-image: -ms-linear-gradient(top, #57a818, #4d9916);
  background-image: -o-linear-gradient(top, #57a818, #4d9916);
  background-image: linear-gradient(to bottom, #57a818, #4d9916);
  text-shadow: 0px 1px 0px #32610e;
  -webkit-box-shadow: 0px 1px 0px fefefe;
  -moz-box-shadow: 0px 1px 0px fefefe;
  box-shadow: 0px 1px 0px fefefe;
  color: #ffffff;
  text-decoration: none;
}
.brandBar {
  position:absolute;
  width:100%;
  height:40px;
  
  z-index:1000;
  line-height:40px;
  color:#ccc;
  padding-left:0px;
}
.nav{
  margin:20px 0;
}
.brandBar img{
  position:absolute;
  width:90px;
  right:20px;
  top:12px;
}
.wrapper {
  position:absolute;
  padding:20px;
}
body {
  margin:10px;
}
button {
  display:inline;
}
var t = TweenLite.to(".green", 1, {x:"+=100"});
$("#restart").click(function(){
  t.restart();
})
$("#invalidate").click(function(){
  t.invalidate();
  t.restart();
})

.invalidate()返回值

.invalidate()的补充说明