public override bool tick() { if (initialW == targetW && initialH == targetH) { return(true); } //Debug.Log(sui.gameObject.name + " w: " + initialW + " " + targetW + " h: " + initialH + " " + targetH); float currentPosition = (System.DateTime.Now.Ticks / 10000L) - startTime; float newW = -1; float newH = -1; switch (type) { case SmartUI.TweenTypes.elasticEnd: newW = LibTween.easeOutElastic(currentPosition, initialW, targetW - initialW, duration, null, null); newH = LibTween.easeOutElastic(currentPosition, initialH, targetH - initialH, duration, null, null); break; case SmartUI.TweenTypes.elasticBoth: newW = LibTween.easeInOutElastic(currentPosition, initialW, targetW - initialW, duration, null, null); newH = LibTween.easeInOutElastic(currentPosition, initialH, targetH - initialH, duration, null, null); break; case SmartUI.TweenTypes.easeStart: newW = LibTween.easeInQuad(currentPosition, initialW, targetW - initialW, duration); newH = LibTween.easeInQuad(currentPosition, initialH, targetH - initialH, duration); break; case SmartUI.TweenTypes.easeEnd: newW = LibTween.easeOutQuad(currentPosition, initialW, targetW - initialW, duration); newH = LibTween.easeOutQuad(currentPosition, initialH, targetH - initialH, duration); break; case SmartUI.TweenTypes.easeBoth: newW = LibTween.easeInOutQuad(currentPosition, initialW, targetW - initialW, duration); newH = LibTween.easeInOutQuad(currentPosition, initialH, targetH - initialH, duration); break; case SmartUI.TweenTypes.linear: newW = LibTween.linear(currentPosition, initialW, targetW - initialW, duration); newH = LibTween.linear(currentPosition, initialH, targetH - initialH, duration); break; } sui.position.width = newW; sui.position.height = newH; if (currentPosition >= duration) { sui.position.width = targetW; sui.position.height = targetH; sui.updateSize(true); return(true); } sui.updateSize(true); return(false); }
public override bool tick() { float currentPosition = (System.DateTime.Now.Ticks / 10000L) - startTime; float scaleMod = LibTween.easeOutElastic(currentPosition, startPos, posMod, duration, amplitude, period); sui.position.width = initialWidth * scaleMod; sui.position.height = initialHeight * scaleMod; if (currentPosition >= duration) { sui.position.width = initialWidth; sui.position.height = initialHeight; return(true); } return(false); }
public override bool tick() { float currentPosition = (System.DateTime.Now.Ticks / 10000L) - startTime; float newX = -1; switch (type) { case SmartUI.TweenTypes.elasticEnd: newX = LibTween.easeOutElastic(currentPosition, initialX, targetX - initialX, duration, null, null); break; case SmartUI.TweenTypes.elasticBoth: newX = LibTween.easeInOutElastic(currentPosition, initialX, targetX - initialX, duration, null, null); break; case SmartUI.TweenTypes.easeStart: newX = LibTween.easeInQuad(currentPosition, initialX, targetX - initialX, duration); break; case SmartUI.TweenTypes.easeEnd: newX = LibTween.easeOutQuad(currentPosition, initialX, targetX - initialX, duration); break; case SmartUI.TweenTypes.easeBoth: newX = LibTween.easeInOutQuad(currentPosition, initialX, targetX - initialX, duration); break; case SmartUI.TweenTypes.linear: newX = LibTween.linear(currentPosition, initialX, targetX - initialX, duration); break; } sui.position.x = newX; if (currentPosition >= duration) { sui.position.x = targetX; return(true); } return(false); }