Skip to content

Commit

Permalink
webgl renderer animate loop
Browse files Browse the repository at this point in the history
- iife recursion
  • Loading branch information
myungjaeyu committed May 25, 2017
1 parent dfb5c09 commit 8db8f72
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ export class AppComponent implements OnInit{
this.renderer.setSize(screen.width, screen.height);
this.container.appendChild(this.renderer.domElement);

this.render();
}

render(){

let self: AppComponent = this;

(function render(){
requestAnimationFrame(render);
self.renderer.render(self.scene, self.camera);

self.animate();
}());

}

animate(){
console.log('animate');
}

}

0 comments on commit 8db8f72

Please sign in to comment.