#leantween

1 messages · Page 1 of 1 (latest)

mental smelt
#

leantween.

#

okay I have watched none

#

show code

#

it changes the text at the top

#

when you do

#

(silently)

#

LeanTween.scale ( gameObject:GameObject vec:Vector3 time:float ) LTDescr
Defined in LeanTween.cs:1600

Scale a GameObject to a certain size
Parameters:
gameObject:GameObject GameObject
gameObject Gameobject that you wish to scale

vec:Vector3 Vector3
to The size with which to tween to

time:float Float
time The time to complete the tween in

Returns:
LTDescr:
LTDescr an object that distinguishes the tween

#

so it looks like it works like a lerp

#

object, desired scale, transition amount

#

so if you plug, say, a float that is counting up by time.deltatime, in update, into the third parameter, and run the method in Update

#

it'll change the scale of the object (first argument) to the scale of (second arguement), based on the third value, which with a timer, will be increasing slowly, giving you a nice smooth transition

#

I'll slap together a quick example

#

beware, typing in discord so syntax may not be exact

#
public float transitionamount = float.negativeInfinity;
public GameObject theObject;
public Vector3 newScale = new Vector3(2,2,2);

void Update()
{
if (transitionamount > float.negativeInfinity)
{
transitionamount += time.deltaTime;
LeanTween.scale (theObject, newScale, transitionamount);
}
}

void StartTheTimer()
{
transitionamount = 0;
}

void StopTheTimer()
{
transitionamount = float.negativeInfinity;
}
#

so ive set up a float timer here that only counts up when its not -infinity

#

oh and i missed some semicolons, lemme edit

#

its also set up in such a way that the tween will only happen while the timer is counting (greater than -infinity)

#

leantween is indeed better, for the reasons don mentioned - its worth learning

#

I'll probably use it from now on too

#

I must have typed it wrong

#

its, well, negative infinity - I use it kind of as a placeholder to keep my timers from going unless I want them to

#

since we're using leantween.scale, they are scale

#

-_-

#

alright well scrap it all then and ill look at that instead

#

float.NegativeInfinity

#

autocorrect always gets the n for me 😛

#

idk why you always get me trying to fix problems you dont have

#

communication issues I guess

#

leantween.move works totally differently, I don't think I can slap together an example, I'd need to test it out to see how it works

#

it looks like it does not work like a lerp, but takes.. a smoothing parameter or something

#

nooo idea

#

when it was scale, they were scale

#

but if you switched it to move, thats now your.. target position

#

from what im reading, move does xyz, but to change the recttransforms, you want to use moveX and moveY

#

looks like they work the same way, second arguement would just be a float though

#

since only one value