This page explains how to use the MMTween library to move objects and interpolate values, without necessarily using a MMF Player

Why use tweens?

While Feel lets you do a lot from the editor only, via the MMF Player and its 150+ feedbacks, you can also do pretty much everything from code directly.

For example, you can create a MMF Player from code directly, and add any feedback you want to it, then play your MMF Player. You can also, very easily, modify any value on a player.

But sometimes you don’t want to setup complex micro interactions, and you just want to add a bit of juice with a single line. When what you’re after is simple, using a MMF Player can be overkill, or something you’d like to avoid. That’s fine, Feel lets you benefit from its extremely decoupled architecture and do pretty much everything via events and tweens.

Tweens

When all you need to do is move an object, or interpolate a value from an origin to a destination, if you don’t want to use a MMF Player, you can simply use the MMTween library.

For example, the line below would move a target object up, over 1s, on an ease-in elastic curve:

MMTween.MoveTransform(this, TargetTransform, new Vector3(0, 0, 0), new Vector3(0, 5, 0), null, 0f, 1f, MMTween.MMTweenCurve.EaseInElastic);

Note that MoveTransform is a Coroutine, so you could also yield it to do something once it’s complete.

You may also be interested in other Tween methods, such as MMTween.MoveRectTransform or MMTween.RotateTransformAround.

You can also use that same tween library to simply interpolate values over time, like you would with a Lerp, but here with more control. With support of most common types, it’s a nice tool to add to your toolbox!

For example, here’s how you’d tween a float value halfway between 0 and 5 along an ease out bounce curve:

float someValue = MMTween.Tween(currentTime: 0.5f, initialTime: 0f, endTime: 1f, startValue:0f, endValue:5f, MMTween.MMTweenCurve.EaseOutBounce);

The same MMTween.Tween method also supports Vector2, Vector3 and Quaternions. Don’t hesitate to check the MMTween class for more on this.