title: requestAnimationFrame is being called only once
body: <p>I'm trying to achieve a pretty basic animation using ThreeJS in my Ionic 2 application. Basically trying to rotate a cube. But the cube isn't rotating because requestAnimationFrame is being executed only once inside the render loop.</p>
  
  <p>I'm able to see only this.
  <a href="https://i.stack.imgur.com/GBi38.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GBi38.png" alt="enter image description here"></a></p>
  
  <p>No rotating animation. I'm sharing my code below.</p>
  
  <p><strong>home.html</strong></p>
  
  <pre><code>&lt;ion-header&gt;
    &lt;ion-navbar&gt;
      &lt;ion-title&gt;
        Ionic Blank
      &lt;/ion-title&gt;
    &lt;/ion-navbar&gt;
  &lt;/ion-header&gt;
  
  &lt;ion-content&gt;
    &lt;div #webgloutput&gt;&lt;/div&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <p><strong>home.ts</strong></p>
  
  <pre><code>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 = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
  
      this.renderer = new THREE.WebGLRenderer();
      this.renderer.setSize( window.innerWidth, window.innerHeight );
      this.webgloutput.nativeElement.appendChild(this.renderer.domElement);
  
      let geometry = new THREE.BoxGeometry(1, 1, 1);
  
      let material = new THREE.MeshBasicMaterial({ color: 0x00ff00});
      this.cube = new THREE.Mesh(geometry, material);
      this.scene.add(this.cube);
      this.camera.position.z = 5;
  
      this.render();
    }
  
  
    render() {
      console.log("render called");
      requestAnimationFrame(() =&gt; this.render);
  
      this.cube.rotation.x += 0.5;
      this.cube.rotation.y += 0.5;
      this.renderer.render(this.scene, this.camera);
    }
  
  }
  </code></pre>