Need help with position tween

I’m still struggling with point A to point B (and back) smooth transitions.

I’m following this guideline:

(x+(interpAccel(Time format, Min, Max, Acceleration Factor)*y))
x = starting point
y = end point

trying to have an object that starts at -130, when tapped rotates to 0, when tapped again rotates back to -130. I thought this would be a simple adaptation of that weird moon wheel transition I used earlier, but no.

$#VAR_1#=1?(-130+(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)0)):(0-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)-130))$

This would seem to follow the above protocol no? But not behaving like planned.

Thanks for any help!

@ThaMattie this is probably an easy one for you :slight_smile:

Why VAR_1_T and not VAR_1?

$#VAR_1#=1?(-130+(interpAccel((#DNOW#-#VAR_1#),0,1000,1)*0)):(0-(interpAccel((#DNOW#-#VAR_1#),0,1000,1)*-130))$

@lucky.andrei I don’t have a handle on Facer expressions yet so I don’t know why Var_1_T, but that’s what I had stumbled into when trying something for another face earlier and it’s what was in the code ThaMattie had helped me with.

I tried cutting and pasting your suggestion but that also does not work (goes to the wrong place for point B as my own code does), and in fact takes a step back by eliminating the transition (only jumps)

I appreciate your taking the time to try to help though!

hmmm, further trial and error found a working solution:

$#VAR_1#=1?((-130)-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)(-130))):(0-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)(130)))$

honestly, even though it works, I still don’t get it!

VAR_1_T is the time the button was tapped, and is needed as offset for the tween time

1 Like
$#VAR_1#=1?((-130)-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*(-130))):(0-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*(130)))$

Then so, for those who copy

As far as the “y = end point” goes, I think it is the distance, not the endpoint
Moving from 20 to 120 would have x = 20 and y = 100
Going from -130 to 0 would be x = -130 and y = 130.

Looking at your working solution this seems sort of what you did. The first one seems to go from -130 to -130 - -130 (which is -130 to 0).
In your expressions I miss the “*” in the *y, but I assume this is because the forum uses it for bold.
It could be written as (-130 + (interpAccel((#DNOW#-#VAR_1_T#),0,1000,1) * 130)) perhaps?

The second expression seems fine, assuming you have the “*” before (130)

$#VAR_1#=1?(-130+(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*130)):(0-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*130))$
2 Likes

Ah, that is an important clarification about what Y means in the formula! Hopefully that detail will help me figure these things out more direct next time. Thanks!