我制作了一个带有css动画和过渡的HTML页面
<div class="container-fluid" id="team">
<div class="row first">
<div class="wrapper"></div>
</div>
<div class="row second">
<div class="wrapper"></div>
<div class="wrapper clickable">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.0.name}}</h2>
<h5>{{team.0.position}}</h5>
<p>{{team.0.description}}</p>
<a href="">Learn more about {{team.0.firstName}}</a>
</div>
</div>
<img src="">
</div>
<div class="wrapper clickable right-side">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.6.name}}</h2>
<h5>{{team.6.position}}</h5>
<p>{{team.6.description}}</p>
<a href="">Learn more about {{team.6.firstName}}</a>
</div>
</div>
<img src="">
</div>
<div class="wrapper"></div>
</div>
<div class="row third">
<div class="wrapper clickable">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.3.name}}</h2>
<h5>{{team.3.position}}</h5>
<p>{{team.3.description}}</p>
<a href="">Learn more about {{team.3.firstName}}</a>
</div>
</div>
<img src="">
</div>
<div class="wrapper clickable">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.2.name}}</h2>
<h5>{{team.2.position}}</h5>
<p>{{team.2.description}}</p>
<a href="">Learn more about {{team.2.firstName}}</a>
</div>
</div>
<img src="">
</div>
<div class="wrapper clickable right-side">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.4.name}}</h2>
<h5>{{team.4.position}}</h5>
<p>{{team.4.description}}</p>
<a href="">Learn more about {{team.4.firstName}}</a>
</div>
</div>
<img src="">
</div>
</div>
<div class="row fourth">
<div class="wrapper"></div>
<div class="wrapper clickable">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.5.name}}</h2>
<h5>{{team.5.position}}</h5>
<p>{{team.5.description}}</p>
<a href="">Learn more about {{team.5.firstName}}</a>
</div>
</div>
<img src="">
</div>
<div class="wrapper clickable right-side">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.1.name}}</h2>
<h5>{{team.1.position}}</h5>
<p>{{team.1.description}}</p>
<a href="">Learn more about {{team.1.firstName}}</a>
</div>
</div>
<img src="">
</div>
<div class="wrapper"></div>
</div>
<div class="row fifth">
<div class="wrapper"></div>
<div class="wrapper join">
<a href="">
<span>+ Join</span>
</a>
</div>
<div class="wrapper clickable right-side">
<div class="shadow"></div>
<div class="description">
<div>
<h2>{{team.7.name}}</h2>
<h5>{{team.7.position}}</h5>
<p>{{team.7.description}}</p>
<a href="">Learn more about {{team.7.firstName}}</a>
</div>
</div>
<img src="">
</div>
</div>
<div class="row sixth">
<div class="wrapper"></div>
<div class="wrapper blank"></div>
<div class="wrapper"></div>
</div>
<div class="row seventh">
<div class="wrapper"></div>
<div class="wrapper"></div>
</div>
此处提供完整的工作版本:http://jsfiddle.net/xs4mm5jd/
正如你所看到它运作良好,动画快速而流畅。
然而,当我添加一些图像时:http://jsfiddle.net/xs4mm5jd/1/动画是glichy。有没有解决方案来加快性能?
答案 0 :(得分:5)
即使我没有看到你的小提琴表现不佳,你也可以在制作动画时触发硬件加速。
有些人会使用transform: translateZ(0);
或transform: translate3d(0, 0, 0);
对动画元素进行某种黑客攻击。
如果你看到任何表现增益,你可以在这里测试:http://jsfiddle.net/gleezer/xs4mm5jd/3/
这是关于它的article。
第二种更新(可能更好)的替代方法是在CSS中使用will-change
属性,例如:will-change: transform;
详细了解here。