//creates a new HOTween tween which moves us to the next waypoint //(defined by passed arguments) internal void CreateTween() { //prepare HOTween's parameters, you can look them up here //http://www.holoville.com/hotween/documentation.html //////////////////////////////////////////////////////////// //create new HOTween plugin for curved paths //pass in array of Vector3 waypoint positions, relative = true plugPath = new PlugVector3Path(wpPos, true, pathtype); //orients the tween target along the path //constrains this game object on one axis if (orientToPath) { plugPath.OrientToPath(); } //create TweenParms for storing HOTween's parameters tParms = new TweenParms(); //sets the path plugin as tween position property tParms.Prop("position", plugPath); tParms.AutoKill(true); //use speed based tween with linear easing tParms.SpeedBased(); tParms.Ease(EaseType.Linear); tParms.OnComplete(OnPathComplete); //create a new tween, move this gameobject with given arguments tween = HOTween.To(transform, maxSpeed, tParms); }
private void Init(string tip) { imageObj = MonoBehaviour.Instantiate(Resources.Load("Tips/TipsImage")) as GameObject; imageObj.GetComponent <RectTransform>().SetParent(tipParent); imageObj.transform.localPosition = new Vector3(0, -100, 0); image = imageObj.GetComponent <Image>(); imageforblack = image.transform.Find("for more black").GetComponent <Image>(); text = imageforblack.transform.Find("my lable").GetComponent <Text>(); text.text = tip; HOTween.Init(); TweenParms parms = new TweenParms(); parms.Prop("localPosition", new PlugVector3Y(50)); parms.Ease(EaseType.EaseOutCubic); parms.Delay(0.1f); parms.OnComplete(MyComplete); HOTween.To(image.rectTransform, 1.5f, parms); #region Legacy DoTween //DOTween.Init(); //Tweener tweener = image.rectTransform.DOMoveY(250f, 1f); //tweener.SetEase(Ease.Linear); //image.material.DOColor(Color.clear,1.5f); //text.material.DOColor(Color.clear, 1.5f); //tweener.OnComplete(MyComplete); #endregion }
private void Show() { GoodsItemVO vo = currSelectedVO; //todo:根据数据初始化整个详情 SetName(vo.name); SetOwn(vo.own); SetDetails(vo.description, vo.extraDescription); SetCost(vo.totalcost, vo.cout, vo.goodsCostType); Convert(); if (temp == null) { this.mTrans.localScale = new Vector3(0.1f, 0.1f, 0.1f); HOTween.Init(); parms = new TweenParms(); parms.Prop("localScale", new Vector3(1f, 1f, 1f)); parms.Ease(EaseType.EaseOutBack); parms.Delay(0.1f); parms.AutoKill(false); temp = HOTween.To(this.mTrans, 0.2f, parms); temp.intId = 1; } temp.PlayForward(); }
void SetPosition(bool isMotion) { //print ("SetPosition"); //print ("isMotion="+isMotion); Vector3 pos = mLocalPosition; //print ("pos1="+pos); //print ("seq="+seq); pos += new Vector3(0f, seq * cellHeight, 0f); //print ("pos2="+pos); //pos -= new Vector3(0f, 300f, 0f); if (isMotion) { //print ("if isMotion"); TweenParms parms = new TweenParms(); parms.Prop("localPosition", pos); parms.Ease(EaseType.EaseOutCirc); HOTween.To(mTrans, 0.1f, parms); HOTween.Play(); } else { //print ("else isMotion"); mTrans.localPosition = pos; } //titleLabel.text = heros[seq].spriteName; }
private IEnumerator Animate() { if (Layer.OldLayer != Layer.OtherLayer) { LayerSetter.SetAllLayerRecursively(gameObject, Layer.OtherLayer); } SetPlayerMotion(false); Transform tweenTarget = LinkedEquipment.transform; if (LinkedEquipment as EquipmentAsGui) { tweenTarget = Player.transform; } TweenParms parms = new TweenParms(); parms.Prop("position", new PlugVector3(tweenTarget.position)); parms.Prop("rotation", new PlugQuaternion(tweenTarget.rotation)); parms.Prop("localScale", new PlugVector3(tweenTarget.localScale)); parms.Ease(EaseType.EaseInOutSine); HOTween.To(transform, TakeAnimationLength, parms); //dan //TODO //yield WaitForSeconds(TakeAnimationLength); yield return(new WaitForSeconds(TakeAnimationLength)); SetPlayerMotion(true); LayerSetter.SetAllLayerRecursively(gameObject, Layer.OldLayer); }
private void TweenToGround(Vector3 groundPos) { TweenParms parms = new TweenParms(); parms.Prop("position", groundPos); parms.Ease(EaseType.Linear); parms.OnComplete(OnTweenToGroundComplete); HOTween.To(gameObject.transform, 0.5f, parms); }
void Start() { HOTween.Init(true, true, true); HOPath path = GetComponent <HOPath>(); TweenParms param = new TweenParms(); param.Prop("position", path.MakePlugVector3Path(), true); param.Loops(-1, type); param.Ease(easeType); HOTween.To(transform, time, param); }
private void Fade() { Color color = renderer.material.color; TweenParms parms = new TweenParms(); parms.Prop("color", new Color(color.r, color.g, color.b, 0)); parms.Ease(EaseType.Linear); parms.OnComplete(OnFadeComplete); HOTween.To(renderer.material, 10.0f, parms); }
public void returnHome() { ParentHand = null; TweenParms parms = new TweenParms(); parms.Prop("position", m_homeWorldPosition); parms.Prop("rotation", m_homeWorldRotation); parms.Ease(EaseType.EaseInOutExpo); parms.Delay(0.25f); parms.OnComplete(returnHomeCompleted); HOTween.To(transform, 0.5f, parms); }
private void TweenToWallHeight(WallPieceView wallPieceView) { Vector3 pos = transform.position; TweenParms parms = new TweenParms(); parms.Prop("position", new Vector3(pos.x, wallPieceView.Height, pos.z)); parms.Ease(EaseType.Linear); parms.OnComplete(OnTweenToWallHeightComplete, wallPieceView.transform.position); HOTween.To(gameObject.transform, 0.5f, parms); }
private void TweenToWallCenter(Vector3 wallPieceViewPos) { Vector3 pos = transform.position; TweenParms parms = new TweenParms(); parms.Prop("position", new Vector3(wallPieceViewPos.x, pos.y, wallPieceViewPos.z)); parms.Ease(EaseType.Linear); parms.OnComplete(OnTweenToWallCenterComplete); HOTween.To(gameObject.transform, 0.5f, parms); }
private void ScaleRoot(bool isOut) { var param = new TweenParms(); if (!isOut) { param.Delay(UnityEngine.Random.Range(_scaleDelayRange.x, _scaleDelayRange.y)); } param.Prop("localScale", isOut ? Vector3.zero : Vector3.one); param.Ease(EaseType.Linear); param.OnComplete(() => transform.localPosition = _initialPosition); HOTween.To(transform, SCALE_DURATION, param); }
//------------------------------------------------------------------------------------- // Update //------------------------------------------------------------------------------------- void Update() { switch (m_Rno) { case 0: { m_Rno = 1; // jump var parms = new TweenParms(); parms.Prop("position", new Vector3(0, 2, 0), true); parms.Ease(EaseType.EaseInOutQuint); parms.Loops(2, LoopType.Yoyo); m_Tweener = HOTween.To(this.transform, 0.6f, parms); // rolling var parms2 = new TweenParms(); var angle = this.transform.eulerAngles; angle.x += 180.0f; parms2.Prop("eulerAngles", new Vector3(360, 0, 0)); parms2.Ease(EaseType.EaseInOutQuint); HOTween.To(this.transform, 1.2f, parms2); } break; case 1: { if (m_Tweener.isComplete) { m_Rno = 2; m_Timer = 0.10f; } } break; case 2: { m_Timer -= Time.deltaTime; if (m_Timer < 0.0f) { m_Rno = 0; } } break; } }
public void Move() { TweenParms parms = new TweenParms(); //移动 parms.Prop("localPosition", MovedPos); parms.Prop("localRotation", new Vector3(0, 0, 0)); parms.Prop("localScale", new Vector3(1, 1, 1)); //运动的类型 parms.Ease(EaseType.EaseInOutCirc); //延迟一秒 parms.Delay(0.1f); //执行动画 HOTween.To(this.transform, 0.5f, parms); }
public override void FireEvent() { if (tweener != null) { return; } TweenParms parms = new TweenParms(); parms.Prop(fieldName, GetTargetValue()); parms.Ease(easeType); parms.AutoKill(false); tweener = HOTween.To(TargetComponent, Duration, parms); }
public void reset() { TweenParms parms = new TweenParms(); //移动 parms.Prop("localPosition", oriPosition); parms.Prop("localRotation", oriRotation); parms.Prop("localScale", oriScale); //运动的类型 parms.Ease(EaseType.EaseInOutCirc); //延迟一秒 parms.Delay(0.1f); //执行动画 HOTween.To(this.transform, 0.5f, parms); }
private void TweenOffWall(WallPieceView wallPieceView, Vector3 direction) { Vector3 target = (wallPieceView.transform.position + new Vector3(0, wallPieceView.Height, 0)) + (direction * GameConfig.BLOCK_SIZE) * (0.75f); Vector3 aboveGroundPos = wallPieceView.transform.position + (direction * GameConfig.BLOCK_SIZE); Vector3 groundPos = new Vector3(aboveGroundPos.x, 0, aboveGroundPos.z); TweenParms parms = new TweenParms(); parms.Prop("position", target); parms.Ease(EaseType.Linear); parms.OnComplete(OnTweenOffWallComplete, groundPos); HOTween.To(gameObject.transform, 0.5f, parms); }
// Use this for initialization void Start() { onBeat = false; retracting = false; transform.position = new Vector3(transform.position.x, transform.position.y - .5f, transform.position.z); //sets the original position origin.Prop("position", transform.position); origin.Ease(EaseType.Linear); //sets the target position switch (direction) { case DJ_Directions.Up: target.Prop("position", transform.position + new Vector3(0, 0, -maxDistance)); break; case DJ_Directions.Down: target.Prop("position", transform.position + new Vector3(0, 0, maxDistance)); break; case DJ_Directions.Left: target.Prop("position", transform.position + new Vector3(maxDistance, 0, 0)); break; case DJ_Directions.Right: target.Prop("position", transform.position + new Vector3(-maxDistance, 0, 0)); break; default: target.Prop("position", transform.position + new Vector3(0, 0, -maxDistance)); break; } target.Ease(EaseType.Linear); _activationScript = GetComponent <DJ_BeatActivation>(); fadeOutAlpha = .3f; fadeOutGlow = 0.6f; gameObject.GetComponent <Renderer>().material.SetFloat("_Alpha", 1); gameObject.GetComponent <Renderer>().material.SetFloat("_GlowStrength", 2); /* * gameObject.GetComponent<MeshRenderer>().enabled = false; * gameObject.GetComponent<BoxCollider>().enabled = false; */ }
private void SetRefreshChoiceOpen() { refreshT.gameObject.SetActive(true); if (parms == null) { refreshT.localScale = new Vector3(0.1f, 0.1f, 0.1f); parms = new TweenParms(); parms.Prop("localScale", new Vector3(1f, 1f, 1f)); parms.Ease(EaseType.EaseOutBack); parms.Delay(0.1f); parms.AutoKill(false); temp = HOTween.To(refreshT, 0.2f, parms); } temp.PlayForward(); }
public void reset() { TweenParms parms = new TweenParms(); //移动 parms.Prop("localPosition", new Vector3(0, 0, 0)); parms.Prop("localRotation", new Vector3(0, 0, 0)); parms.Prop("localScale", new Vector3(1, 1, 1)); //运动的类型 parms.Ease(EaseType.EaseInOutCirc); //延迟一秒 parms.Delay(0.1f); //执行动画 HOTween.To(this.transform, 0.5f, parms); GetComponent <AudioSource>().clip = resetAudioClip; GetComponent <AudioSource>().Play(); }
public void DestroyPaint(float duration) { if (_completedCharPosition == null) { return; } var initScale = _texturePaint.transform.localScale; var param = new TweenParms(); param.Prop("localScale", Vector3.zero); param.Ease(EaseType.Linear); param.OnComplete(() => { TexturePaint.ClearColorBufferToTexture(); _texturePaint.transform.localScale = initScale; }); HOTween.To(_texturePaint.transform, duration, param); }
private void ShowHideGuessingChar(bool isShow) { _guessingChar.transform.localScale = isShow ? Vector3.zero : Vector3.one; var param = new TweenParms(); param.Prop("localScale", isShow ? Vector3.one : Vector3.zero); param.Ease(EaseType.Linear); // float max = _bubbleCharList[0].ScaleDuration; // for (int i=0; i < _bubbleCharList.Count; i++) { // if (max < _bubbleCharList[i].ScaleDuration) // max = _bubbleCharList[i].ScaleDuration; // } //float bb = _bubbleCharList.Max(x => x.ScaleDuration); float max = _bubbleCharList.FindMax(x => x.ScaleDuration); HOTween.To(_guessingChar.transform, max, param); }
//------------------------------------------------------------------------------------- // Update //------------------------------------------------------------------------------------- void Update() { switch (m_Rno) { case 0: { m_Rno = 1; var parms = new TweenParms(); parms.Prop("localScale", new Vector3(1.3f, 1.3f, 1.3f)); parms.Ease(EaseType.EaseOutBounce); m_Tweener = HOTween.To(this.transform, 0.80f, parms); } break; case 1: { if (m_Tweener.isComplete) { m_Rno = 2; var parms = new TweenParms(); parms.Prop("localScale", new Vector3(1, 1, 1)); parms.Ease(EaseType.Linear); m_Tweener = HOTween.To(this.transform, 0.30f, parms); } } break; case 2: { if (m_Tweener.isComplete) { m_Rno = 0; } } break; } }
private void Move(float _y, bool firstStep) { if (action == actions.CHANGING_LANE) { return; } CantMoveUp = false; CantMoveDown = false; Events.OnChangeLane(); action = actions.CHANGING_LANE; Events.OnSoundFX("changeLane"); TweenParms parms = new TweenParms(); parms.Prop("localPosition", new Vector3(0, _y, 0)); parms.Ease(EaseType.Linear); parms.OnComplete(OnChangeLaneComplete); HOTween.To(container.transform, timeToCrossLane, parms); }
// Use this for initialization void Start() { onBeat = false; retracting = false; transform.position = new Vector3(transform.position.x, transform.position.y - .5f, transform.position.z); //sets the original position origin.Prop("position", transform.position); origin.Ease(EaseType.Linear); target.Prop("position", transform.position + new Vector3(0, -maxDistance, 0)); target.Ease(EaseType.Linear); _activationScript = GetComponent <DJ_BeatActivation>(); fadeOutAlpha = 0.3f; fadeOutGlow = 0.6f; gameObject.GetComponent <Renderer>().material.SetFloat("_Alpha", fadeOutAlpha); gameObject.GetComponent <Renderer>().material.SetFloat("_GlowStrength", fadeOutGlow); }
public void Move(Vector3 target) { if (Moving) { return; } Vector3 from = gameObject.transform.position; OnMoveBegin(from, target); TweenParms parms = new TweenParms(); parms.Ease(EaseType.Linear); parms.Prop("position", target); parms.OnComplete(OnMoveComplete, from, target); Moving = true; HOTween.To(gameObject.transform, 0.5f, parms); }
public void fadeOutAlphaAndDistroy(float delay = 0.3f, float time = 0.3f, bool addToKillList = true) { //Debug.Log ("alpha:"+alpha.ToString()); /////////////////////////////////////////////////////////// TweenParms parms = new TweenParms(); parms.Ease(EaseType.Linear); // Easing type parms.Prop("alpha", 0.0f); parms.Delay(delay); parms.OnComplete(fadeAlphaComplete, 0); if (addToKillList) { Game.tweensToKillArr.Add(HOTween.To(this, time, parms)); } else { HOTween.To(this, time, parms); } /////////////////////////////////////////////////////////// }
public Poker close(Del func, float delay = 0) { scaleType = "close"; if (!isOpen) { return(this); } funcAfterClose = func; // C# TweenParms parms = new TweenParms(); //parms.Prop("localPosition", new Vector3((float)j*(card_wid+gap)+card_wid/2.0f+start_x,hei_750-start_y-card_hei/2.0f-((float)i)*back_next_dis,0)); // Position tween parms.Ease(EaseType.Linear); // Easing type parms.Delay(delay); // Initial delay //parms.OnStart(onStart,card); parms.Prop("localScale", new Vector3(0f, 1f * Game.card_scale, 1f * Game.card_scale)); parms.OnComplete(scale0Complete, this.gameObject.name); HOTween.To(this.gameObject.transform, 0.1f, parms); return(this); }
private void scale0Complete(TweenEvent e) { if (scaleType == "open") { textureSprite = AssetsManager.getSpriteByFile(image_path); } else { textureSprite = AssetsManager.getSpriteByFile("images/cards/back"); //Debug.Log (textureSprite); } this.gameObject.transform.FindChild("textureSprite").GetComponent <SpriteRenderer> ().sprite = textureSprite; /////////////////////////////////////////////////////////// TweenParms parms = new TweenParms(); parms.Ease(EaseType.Linear); // Easing type parms.Prop("localScale", new Vector3(1f * Game.card_scale, 1f * Game.card_scale, 1f * Game.card_scale)); parms.OnComplete(scale1Complete, this.gameObject); HOTween.To(this.gameObject.transform, 0.1f, parms); /////////////////////////////////////////////////////////// }
// Set current table position; void SetPosition(bool isMotion) { Vector3 pos = mLocalPosition; pos -= new Vector3(seq * cellWidth, 0f, 0f); if (isMotion) { TweenParms parms = new TweenParms(); parms.Prop("localPosition", pos); parms.Ease(EaseType.Linear); HOTween.To(mTrans, 0.1f, parms); HOTween.Play(); } else { mTrans.localPosition = pos; } if (titleLabel != null) { titleLabel.text = heros[seq].spriteName; } }