|
@@ -7,9 +7,16 @@
|
|
|
v-show="showTree"
|
|
|
class="img-wrapper"
|
|
|
>
|
|
|
+ <div
|
|
|
+ class="bbg"
|
|
|
+ :style="{
|
|
|
+ backgroundImage: `url(${require('@/assets/image/tall-tree.png')})`,
|
|
|
+ backgroundPosition:`0 calc(100% - ${animationBottom.value}px)`
|
|
|
+ }"
|
|
|
+ />
|
|
|
<img
|
|
|
id="tree-image"
|
|
|
- src="@/assets/image/tall-tree.png"
|
|
|
+ src="@/assets/image/tall-tree-for-computing-height.jpg"
|
|
|
alt=""
|
|
|
@load="onTreeImgLoad"
|
|
|
>
|
|
@@ -67,8 +74,7 @@ export default {
|
|
|
methods: {
|
|
|
animate() {
|
|
|
TWEEN.update()
|
|
|
- // 这个动画如果用css实现,在ios里会有图片显示不全的问题。
|
|
|
- this.treeImageNode.style.bottom = this.animationBottom.value + 'px'
|
|
|
+ // 这个动画如果用css实现,在ios里会有图片显示不全的问题。如果用tree img元素绝对定位且动态改变位置,在安卓版微信内置浏览器上又会有bug。
|
|
|
this.requestAnimationId = requestAnimationFrame(this.animate)
|
|
|
},
|
|
|
onTreeImgLoad() {
|
|
@@ -76,7 +82,6 @@ export default {
|
|
|
|
|
|
this.timeoutId = setTimeout(() => {
|
|
|
this.treeImageNode = document.getElementById('tree-image')
|
|
|
-
|
|
|
const tween1 = new TWEEN.Tween(this.animationBottom)
|
|
|
tween1.to({
|
|
|
value: -this.treeImageNode.clientHeight * 0.305
|
|
@@ -151,17 +156,25 @@ export default {
|
|
|
top: 0;
|
|
|
bottom: 0;
|
|
|
overflow: hidden;
|
|
|
- > img {
|
|
|
- position: absolute;
|
|
|
+ .bbg{
|
|
|
width: 100%;
|
|
|
- opacity: 0;
|
|
|
- bottom: 0;
|
|
|
+ height: 100%;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100% auto;
|
|
|
+ background-position: 0 100%;
|
|
|
animation-name: emerge;
|
|
|
animation-duration: 1s;
|
|
|
animation-timing-function: linear;
|
|
|
animation-delay: 0s;
|
|
|
animation-fill-mode: forwards;
|
|
|
}
|
|
|
+ > img {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ opacity: 0;
|
|
|
+ bottom: 0;
|
|
|
+ z-index: -1;
|
|
|
+ }
|
|
|
}
|
|
|
> .loading {
|
|
|
position: fixed;
|