Creating animations using DOTween

Please tell me how to implement this animation on DOTWEEN, I tried and I even got something like this, but not to the end.

What are you having trouble with in the animation? It’s a 13 second video with a ton of different ones shown. You also didn’t even show code of what you tried, what about it doesn’t work, and what you’re even really trying to do.

Here’s my best guess to your solution. http://forum.demigiant.com/index.php?topic=225.0

I’m sorry about the animation of stacking blocks into a stack

Doesn’t seem particularly difficult. In the video, it looks like they just tweened them into a close position, and then snapped them into place when the animation was finished.

Yes! But somehow magically I can’t do it

I wrote this code
private void Update()
{
HaystackMovingToStack();
}

public void PicksUp(Haystack haystack)
{
_haystack = haystack;

_freePositionForHaystack = TryGetFreeHaystack();
}

private void HaystackMovingToStack()
{
if (_haystack == null)
return;

if (_freePositionForHaystack == null)
return;

if (!_attracts)
return;

_sequence.Append(_haystack.transform.DOMove(_freePositionForHaystack.transform.position, .5f));
_sequence.Join(_haystack.transform.DORotate(_freePositionForHaystack.transform.rotation.eulerAngles, .5f));
_sequence.Join(_haystack.transform.DOScale(_freePositionForHaystack.transform.localScale, .5f));

_sequence.OnComplete(Connection);
}

private void Connection()
{
_attracts = false;

_haystack.transform.parent = transform;

_haystack = null;
}

private PositionForHaystack TryGetFreeHaystack()
{
return (Cells.Where(cell => !cell.IsWorth).Select(cell => cell.PositionsForHaystacks)).FirstOrDefault();
}

The Pickup method is called from outside when picking up

When posting code in the forum, please use Code Tags , so code is easy for people to read.

Next time, that’s exactly what I’ll do.

You can edit your post.

So, what does it do, and what’s not working with it? Try to give as much information as possible.

The Connection() method that is called at the end of the sequence is not executed

I’ve never used DOTween, but looking at code using it, it looks like you’re supposed to Chain when using OnComplete, as it only calls it after the chained method. Since you don’t have a chain, I don’t believe it would do anything. What you want, is to use AppendCallback instead, which adds a callback to the end of your sequence.