gpt4 book ai didi

javascript - Polymer 上滑动画 : how to make it start from the bottom of the page?

转载 作者:行者123 更新时间:2023-11-29 19:20:23 24 4
gpt4 key购买 nike

使用 Polymer 1.1 我正在尝试使用 slide-up-animation。我遇到的问题是,当它向上滑动时,它是从页面中间开始的,而不是从底部开始向上滑动的。

虽然它不在文档中,但此代码示例 https://github.com/PolymerElements/neon-animation/blob/master/demo/dropdown/animated-dropdown.html显示我可以使用 transformOrigin。但是,它对我不起作用。不知道是不是因为我用的是霓虹动画页面。关于如何让它从页面底部向上滑动的任何想法?

    <neon-animated-pages selected="[[selected]]"
>
<portfolio-page></portfolio-page>

 <script>
Polymer({
is: "portfolio-page",
behaviors: [Polymer.NeonAnimatableBehavior,
Polymer.NeonAnimationRunnerBehavior],
properties: {
animationConfig: {
type: Object,
value: function() {
return {
'entry': {
name: 'slide-up-animation',
node: this,
transformOrigin: 'bottom'
},
'exit': {
name: 'slide-up-animation',
node: this,
transformOrigin: 'bottom'
}
}
}
},

最佳答案

你不能使用上滑,你必须创建一个不同的动画:

<script>

Polymer({

is: 'slide-from-bottom-animation',

behaviors: [
Polymer.NeonAnimationBehavior
],

configure: function(config) {
var node = config.node;

if (config.transformOrigin) {
this.setPrefixedProperty(node, 'transformOrigin', config.transformOrigin);
} else {
this.setPrefixedProperty(node, 'transformOrigin', '50% 0');
}

this._effect = new KeyframeEffect(node, [
{'transform': 'translateY(100%)'},
{'transform': 'none'}
], this.timingFromConfig(config));

return this._effect;
}

});

</script>

关于javascript - Polymer 上滑动画 : how to make it start from the bottom of the page?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33323831/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com