Jump to content

sync audio to start of tween


Recommended Posts



I'm trying to sync audio to the start of a tween.


this.myTween = this.add.tween(...)

this.myTween.onStart.add(this.playSound, this)


Instead, the audio plays first and then a few moments later the tween starts.


I read the onStart should wait until the tween starts, but this doesn't seem to be happening.


Please help!


Link to comment
Share on other sites

Hi, the tween moves the sprite.  The sound needs to play at the start of this movement.  I'm not sure how to set the delay to zero.


tween1: function() {

  this.tweenMini1 = this.add.tween(this.spriteMini).to({ y: this.world.centerY}, 2000, Phaser.Easing.Back.In, true, 0);
  this.tweenMini1.onStart.add(this.playSwoosh, this);



playSwoosh: function() {
  this.swoosh.volume = 0.3;

Link to comment
Share on other sites

your delay is 0 already


I believe it's your easing.. look here:



see how it goes down and then up... (i've marked it in green).. I think you're not seeing it until the up part of the graph there. if it's an opacity alpha then of course you're not going to see any negative alpha... so yes it's going to look delayed

[edit: sorry you're tweening Y.. i'm not sure about that then.. it depends where your sprite is starting. you should see it moving if it's on screen)


I'm don't know what easings Phaser includes but use this to compare with what you need




Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...