html - 在动画启动画面后移动到下一页

标签 html css angular ionic-framework

我是 ionic4/angular4 的新手。我在一个页面中创建了一个漂亮的动画启动画面,但是在启动画面动画在某个时间点结束后,我需要前进到另一个页面。我提供了我的配置详细信息,但我没有安装 cordova s​​plash 插件。我认为不需要。请通过提供代码片段来帮助我。我被困了两天。

export class HomePage {
splash= true;
  constructor() {}

  ionViewDidLoad() {
    setTimeout(() => 
    {
      this.splash = false;
    }, 4000);
  }

}
ion-content {
	--background: #FFBF00;
}

.tree {
	left: 0;
	right: 5%;
	margin: 0 auto;
	top: 50%;
	transform: translateY(-50%);
	width: 100%;
	position: absolute;
}

.tree>div {
	position: absolute;
	height: 100%;
	width: 100%;
	background: #FFBF00;
	top: 0;
	left: 0;
	-webkit-animation-name: hello;
	-webkit-animation-duration: 5s;
	-webkit-animation-fill-mode: forwards;
	animation-name: hello;
	animation-duration: 5s;
	animation-fill-mode: forwards;
}

@keyframes hello {
	0% {
		height: 100%;
	}
	100% {
		height: 0%;
	}
}

@-webkit-keyframes hello {
	0% {
		height: 100%;
	}
	100% {
		height: 0%;
	}
}
<ion-content>
<div class="tree" text-center [style.display]="splash ? 'block': 'none'">
    <div></div>
    <img src="assets/logo.svg">
  </div>

</ion-content>

配置文件

<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashScreenDelay" value="0" />
<preference name="ShowSplashScreen" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />

最佳答案

config.xml 文件下面添加一行

    <preference name="FadeSplashScreen" value="false"/>
  <preference name="AutoHideSplashScreen" value="false"/>

并使用 modalController 进行 splashScreen 显示,例如,

ionViewDidEnter() {

  this.splashScreen.hide();

  setTimeout(() => {
    this.modalCtrl.dismiss();
  }, 4000);

}

关于html - 在动画启动画面后移动到下一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57004128/

相关文章:

javascript - 带括号的 ES6 箭头函数

javascript - 对齐d3折线图中的标签

javascript - 自定义组合框下拉问题

java - 将 JxBrowser 内容添加到 JPanel

javascript - 使用 background-size :contain 时获取 div 背景图像的 XY 坐标和高度/宽度

angular - 从服务中按键查询单个 Firebase 对象

javascript - 获取 jQuery 表单 - 通过 id 获取文本值

javascript - 滚动时改变div的高度

javascript - 将 'Fade out/Fade in' 添加到响应式媒体查询

javascript - Ionic 运行功能仅一次(首次运行应用程序时)