我正试图在我的Ionic 2应用程序中使用ThreeJS实现一个非常基本的动画.基本上是试图旋转立方体.但是多维数据集不会旋转,因为requestAnimationFrame只在render循环中执行一次.
没有旋转动画.我在下面分享我的代码.
home.html的
<ion-header>
<ion-navbar>
<ion-title>
Ionic Blank
</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<div #webgloutput></div>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
home.ts
import { Component, ViewChild, ElementRef } from '@angular/core';
import { NavController } from 'ionic-angular';
import * as THREE from 'three';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild('webgloutput') webgloutput: ElementRef;
private renderer: any;
private scene: any;
private camera: any;
private cube: any;
constructor(public navCtrl: NavController) {
}
ngOnInit() {
this.initThree();
}
initThree() {
this.scene = new THREE.Scene();
this.camera = …Run Code Online (Sandbox Code Playgroud) Ionic 2使用Ionic默认SASS色彩图($ colors)的键(例如主键),很容易在组件模板中使用配色方案.但是有没有传递地图名称的选项,就像可以通过调用SASS color()函数从模板SCSS完成一样?
假设我编写了多个SASS贴图,为了探索不同的颜色方案,命名与$ colors不同,我如何从组件模板HTML中引用特定SASS颜色贴图中的特定颜色键?
从组件SCSS,没有这样的问题,因为我可以使用SASS的color()函数传递我的自定义颜色映射.
我想说的是这是Ionic 2 variable.scss文件
variables.scss
$colors: (
primary: #488aff,
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222
);
Run Code Online (Sandbox Code Playgroud)
我可以在组件模板HTML中从此映射访问颜色键,例如'primary',如:
一些-component.html
<ion-navbar color="primary"></ion-navbar>
Run Code Online (Sandbox Code Playgroud)
现在,如果我在variables.scss中编写更多SASS映射,如:
variables.scss(已修改)
$colors: (
primary: #488aff,
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222
);
$bluegray-lightgreen: (
primary: #546e7a,
secondary: #76ff03,
primary-light: #819ca9,
primary-dark: #29434e,
secondary-light: #b0ff57,
secondary-dark: #32cb00,
primary-text: #ffffff,
secondary-text: #000000
);
Run Code Online (Sandbox Code Playgroud)
如何在组件模板HTML中使用$ bluegray-lightgreen映射中的"主要"颜色键.
注意:我知道所有的解决方法,但我想知道这是否可行.有人可能想要对配色方案配置文件执行此操作,并且可能希望仅从模板轻松切换不同的颜色映射.