# Multitarget tween with different parameters

**URL:** <https://phaser.discourse.group/t/multitarget-tween-with-different-parameters/5403>\
**Category:** Phaser 3\
**Created:** [March 5, 2020, 11:19am UTC](https://phaser.discourse.group/t/multitarget-tween-with-different-parameters/5403 "2020-03-05T11:19:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coatl](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/coatl/32/2176_2.png) [@Coatl](https://phaser.discourse.group/u/Coatl)\
**Post date:** [March 5, 2020, 11:19am UTC](https://phaser.discourse.group/t/multitarget-tween-with-different-parameters/5403/1 "2020-03-05T11:19:31Z")

</div>

Hello, let’s say I have a tween for a large array of targets. Is there a way to set slightly different parameters for different targets? For example, a random delay, or different alpha depending on (index modulo 2) ?  
The only solution I can come up with is making a different tween for each array entry. Or making several different tweens, and assigning a special sub-array to each one. But I’d like to use something efficient yet simple.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 5, 2020, 5:15pm UTC](https://phaser.discourse.group/t/multitarget-tween-with-different-parameters/5403/2 "2020-03-05T17:15:33Z")

</div>

You can pass functions.

```javascript
this.tweens.add({
  // …
  alpha: function(target, targetKey, value, targetIndex, totalTargets, tween) {
    return targetIndex % 2;
  },
  delay: function(target, targetKey, value, targetIndex, totalTargets, tween) {
    return Math.random() * 1000;
  }
});

```

[http://labs.phaser.io/edit.html?src=src/tweens\stagger.js](http://labs.phaser.io/edit.html?src=src/tweens%5Cstagger.js)

---

<div class="post-metadata">

**Author:** ![Coatl](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/coatl/32/2176_2.png) [@Coatl](https://phaser.discourse.group/u/Coatl)\
**Post date:** [March 9, 2020, 4:07pm UTC](https://phaser.discourse.group/t/multitarget-tween-with-different-parameters/5403/3 "2020-03-09T16:07:57Z")

</div>

Oh, this is great! Thank you
