Scaling object with time


I am trying to scale an object up and down between 2 set values with time. I have tried the function from the manipulating entities tutorial, but it just makes the object disappear.

    this.timer += dt;
    var s = Math.sin(this.timer) + 1;
    this.entity.setLocalScale(s, s, s);

You probably end up with s = 0 when this.timer = 3 * Math.PI / 2. Setting zero scale can lead to stuff disappearing so you could try something like s = Math.max(Math.sin(this.timer) + 1, 0.0001) to avoid ever setting scale to 0.