我知道您可以根据其运行时值为动画设置动画。例如。这个例子来自Angular 2 GUIDE:
.skills-container {
position: relative;
width: 100%;
height: 700px;
background-color: #e1e1e1;
margin-top: 0;
padding: 0;
bottom: 0;
}
.title.second {
color: black;
text-align: center;
margin-bottom: 0px;
padding-top: 40px;
font-family: 'Raleway', sans-serif;
font-size: 55px;
}
#underline-second {
max-width: 500px;
margin: 0 auto;
border-bottom: 5px solid black;
margin-bottom: 40px;
}
.skills-wrapper {
position: relative;
margin: auto;
max-width: 1200px;
width: 100%;
height: 500px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
.skills {
position: relative;
width: 23%;
height: 470px;
margin-top: 10px;
border-right: 4px solid black;
}
.skills.last {
border: none;
}
.logo {
max-width: 265px;
width: 100%;
height: 340px;
margin-top: 10px;
}
.ion-social-html5 {
text-align: center;
font-size: 280px
}
.des {
font-size: 25px;
margin-top: 0px;
color: black;
}
.ion-social-css3 {
text-align: center;
font-size: 280px
}
.ion-social-javascript {
text-align: center;
font-size: 280px
}
.ion-social-angular {
text-align: center;
font-size: 280px
}
@media all and (max-width: 320px) {
.skills-container {
position: relative;
width: 100%;
height: 700px;
background-color: #e1e1e1;
margin-top: 0;
padding: 0;
bottom: 0;
}
.title.second {
font-size: 18px;
margin-bottom: 0;
}
#underline-second {
border-bottom: 2px solid #0A0A0A;
max-width: 200px;
width: 100%;
margin-bottom: 0
}
.skills-wrapper {
position: absolute;
margin: auto;
width: 100%;
height: 500px;
}
.lang {
font-size: 40px;
}
.skills {
float: left;
width: 50%;
height: 50%;
margin-top: 10px;
text-align: center;
display: flex;
flex-flow: row wrap;
justify-content: center;
align-items: center;
flex-direction: column;
border-right: none;
}
.des {
font-size: 14px;
}
}
但是可以根据另一个属性的运行时值来设置属性的动画吗?例如。我想将边距从0px设置为当前宽度。
<div class="skills-container">
<div id="underline-second">
<h1 class="title second" id="skills">Skills</h1>
</div>
<div class="skills-wrapper wow bounceInUp" data-wow-duration="2s" data-wow-offset="280">
<div class="skills">
<div class="logo">
<div class="ion-social-html5 lang">
<p class="des">HTML5</p>
</div>
</div>
</div>
<div class="skills">
<div class="logo">
<div class="ion-social-css3 lang">
<p class="des">CSS3</p>
</div>
</div>
</div>
<div class="skills">
<div class="logo">
<div class="ion-social-javascript lang">
<p class="des">JAVASCRIPT</p>
</div>
</div>
</div>
<div class="skills last">
<div class="logo">
<div class="ion-social-angular lang">
<p class="des">ANGULAR JS</p>
</div>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
我认为不可能。
E.g。我想将边距从0px设置为当前宽度。
这可以通过transform:translateX(-100%)完成,因为百分比是指当前宽度。而且它比动画边缘左边更平滑。