对于曲线运动,您可以使用rotate
和的组合transform-origin
。
这将以与您的第二个视频相同的曲线运动为元素设置动画:
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/neon-animation/neon-animation-behavior.html">
<link rel="import" href="../bower_components/neon-animation/web-animations.html">
<script>
Polymer({
is: 'rotate-animation',
behaviors: [
Polymer.NeonAnimationBehavior
],
configure: function(config) {
var node = config.node;
this._effect = new KeyframeEffect(node, [
{'transform': 'none'},
{'transform': 'rotate(90deg)'}
], this.timingFromConfig(config));
if (config.transformOrigin) {
this.setPrefixedProperty(node, 'transformOrigin', config.transformOrigin);
} else {
this.setPrefixedProperty(node, 'transformOrigin', 'center -50vw');
}
return this._effect;
}
});
</script>