These are chat archives for Zhouzi/TheaterJS

May 2016
Felipe Becerra
May 16 2016 04:20
hi! , i need run a function after end scene , any solution?
Gabin Aureche
May 16 2016 07:23

Hey @polloNoEnd_twitter! There are a few ways to do that and it all depends on what you are looking for.

If you want to call a function after a scene ends:

  .addScene('vader:I am your father!')
  .addScene(function (done) {
    alert('wow, such a revelation!');

    // you can do whatever you want, the only thing that matter
    // is that you call "done()" to play the next scene

If you want to call a function every time a scenes ends, you can listen to the relevant events, e.g:

  .on('type:start, erase:start', function () {
    var actor = theater.getCurrentActor()

And here's the documentation regarding event listeners: