Tween Value missing option

I‘m confused about the tweening of a value using a expression.
There is no option to set the tween time, but an option to set the weighting which makes this function for me kind of useless. Is there maybe a way to set the tween time? And what does the weighting even do exactly? Thankss

Hi, could you describe in which context you are using the tween? If I use it with a sprite object I get this menu and I can set a time as usual:

1 Like

I’ve looked through the create Tween functions (scene and object) and every single one takes a parameter “Duration”. Can you screen shot what you have or are doing?

1 Like

Im Sorry, Ive meant using the tween in an expression.
I have a Group with many Objects, I want to tween their Opacity via expression, this way none of the Objects need to have the tween behavior which safes performance.

I see. Unfortunately, I have no clue what the weighting does and I hope someone can chime in and let us know.

1 Like

I have no idea what it’s for either. I checked the wiki but it’s no help.

I’ve changed the category for this thread so maybe one of the GDevelop staff will spot it and can shed light on what this expression does.

1 Like

I’m not sure if that approach will work - I would have thought an object needs the tween behaviour in order to use it.

1 Like

I guess this is what you want to do.

1 Like

According to the Javascript source, weight is a number between 0 and 1 and it seems similar to a lerp or ratio.

const easingFunctions = gdjs.evtTools.tween.easingFunctions;

        const easingFunction = easingFunctions.hasOwnProperty(easingValue)
          ? easingFunctions[easingValue]
          : easingFunctions.linear;
        return fromValue + (toValue - fromValue) * easingFunction(weighting);

      export type EasingFunction = (progress: float) => float;




but wouldn’t it be possible if you can tween just a number value in a scene variable?

basically, yes.

Yes. I thought you wanted to run a tween on each object without adding the tween behaviour to the object.

To me, using a scene tween for this doesn’t make sense. Unless all objects change opacity at the same time and rate, you’ll need a multitude of tweens running.

And I doubt you’d see any performance benefit - if there is any. You not only need to run a tween, but then use an action to change the opacity. An objects’ opacity tween on the other hand should be pretty much optimised.