• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TweenAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TweenAction的典型用法代码示例。如果您正苦于以下问题:C# TweenAction类的具体用法?C# TweenAction怎么用?C# TweenAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TweenAction类属于命名空间,在下文中一共展示了TweenAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: setTextAlpha

 public LTDescr setTextAlpha()
 {
     this.type = TweenAction.TEXT_ALPHA;
     this.initInternal = ()=>{
         this.uiText = trans.gameObject.GetComponent<UnityEngine.UI.Text>();
         this.fromInternal.x = this.uiText != null ? this.uiText.color.a : 1f;
     };
     this.easeInternal = ()=>{ textAlphaRecursive( trans, easeMethod().x, this.useRecursion ); };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:10,代码来源:LTDescr.cs


示例2: update


//.........这里部分代码省略.........
							isTweenFinished = true;
							tween.passed = Mathf.Epsilon;
						}
					}

					if (!tween.hasInitiliazed && ((tween.passed == 0.0 && tween.delay == 0.0) || tween.passed > 0.0))
					{
						tween.init();
					}

					if (tween.delay <= 0)
					{
						// Move Values
						if (timeTotal <= 0f)
						{
							//Debug.LogError("time total is zero Time.timeScale:"+Time.timeScale+" useEstimatedTime:"+tween.useEstimatedTime);
							ratioPassed = 1f;
						}
						else
						{
							ratioPassed = tween.passed / timeTotal;
						}

						if (ratioPassed > 1.0f)
						{
							ratioPassed = 1.0f;
						}
						else if (ratioPassed < 0f)
						{
							ratioPassed = 0f;
						}
						// Debug.Log("action:"+tweenAction+" ratioPassed:"+ratioPassed + " timeTotal:" + timeTotal + " tween.passed:"+ tween.passed +" dt:"+dt);

						if (tweenAction >= TweenAction.MOVE_X && tweenAction < TweenAction.MOVE)
						{
							if (tween.animationCurve != null)
							{
								val = tweenOnCurve(tween, ratioPassed);
							}
							else
							{
								switch (tween.tweenType)
								{
									case LeanTweenType.linear:
										val = tween.from.x + tween.diff.x * ratioPassed; break;
									case LeanTweenType.easeOutQuad:
										val = easeOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break;
									case LeanTweenType.easeInQuad:
										val = easeInQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break;
									case LeanTweenType.easeInOutQuad:
										val = easeInOutQuadOpt(tween.from.x, tween.diff.x, ratioPassed); break;
									case LeanTweenType.easeInCubic:
										val = easeInCubic(tween.from.x, tween.to.x, ratioPassed); break;
									case LeanTweenType.easeOutCubic:
										val = easeOutCubic(tween.from.x, tween.to.x, ratioPassed); break;
									case LeanTweenType.easeInOutCubic:
										val = easeInOutCubic(tween.from.x, tween.to.x, ratioPassed); break;
									case LeanTweenType.easeInQuart:
										val = easeInQuart(tween.from.x, tween.to.x, ratioPassed); break;
									case LeanTweenType.easeOutQuart:
										val = easeOutQuart(tween.from.x, tween.to.x, ratioPassed); break;
									case LeanTweenType.easeInOutQuart:
										val = easeInOutQuart(tween.from.x, tween.to.x, ratioPassed); break;
									case LeanTweenType.easeInQuint:
										val = easeInQuint(tween.from.x, tween.to.x, ratioPassed); break;
									case LeanTweenType.easeOutQuint:
开发者ID:djfdat,项目名称:UnityTemplateProject-FolderStructure,代码行数:67,代码来源:LeanTween.cs


示例3: pushNewTween

    private static LTDescr pushNewTween( GameObject gameObject, Vector3 to, float time, TweenAction tweenAction, LTDescr tween )
    {
        init(maxTweens);
        if(gameObject==null)
        return null;
        tween.trans = gameObject.transform;
        tween.to = to;
        tween.time = time;
        tween.type = tweenAction;
        //tween.hasPhysics = gameObject.rigidbody!=null;

        return tween;
    }
开发者ID:KittyMac,项目名称:LeanTween,代码行数:13,代码来源:LeanTween.cs


示例4: setGUIScale

 public LTDescr setGUIScale()
 {
     this.type = TweenAction.GUI_SCALE;
     this.initInternal = ()=>{ this.from = new Vector3(this._optional.ltRect.rect.width, this._optional.ltRect.rect.height, 0); };
     this.easeInternal = ()=>{ Vector3 v = easeMethod(); this._optional.ltRect.rect = new Rect( this._optional.ltRect.rect.x, this._optional.ltRect.rect.y, v.x, v.y); };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例5: setMoveCurved

 public LTDescr setMoveCurved()
 {
     this.type = TweenAction.MOVE_CURVED;
     this.initInternal = this.initFromInternal;
     this.easeInternal = ()=>{
         newVect = easeMethod();
         val = newVect.x;
         if(this._optional.path.orientToPath){
             if(this._optional.path.orientToPath2d){
                 this._optional.path.place2d( trans, val );
             }else{
                 this._optional.path.place( trans, val );
             }
         }else{
             trans.position = this._optional.path.point( val );
         }
     };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:19,代码来源:LTDescr.cs


示例6: setDelayedSound

 public LTDescr setDelayedSound()
 {
     this.type = TweenAction.DELAYED_SOUND;
     this.initInternal = ()=>{ this.hasExtraOnCompletes = true; };
     this.easeInternal = this.callback;
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例7: setGUIMoveMargin

 public LTDescr setGUIMoveMargin()
 {
     this.type = TweenAction.GUI_MOVE_MARGIN;
     this.initInternal = ()=>{ this.from = new Vector2(this._optional.ltRect.margin.x, this._optional.ltRect.margin.y); };
     this.easeInternal = ()=>{ Vector3 v = easeMethod(); this._optional.ltRect.margin = new Vector2(v.x, v.y); };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例8: setCanvasMoveZ

 public LTDescr setCanvasMoveZ()
 {
     this.type = TweenAction.CANVAS_MOVE_Z;
     this.initInternal = ()=>{ this.fromInternal.x = this.rectTransform.anchoredPosition3D.z; };
     this.easeInternal = ()=>{ Vector3 c = this.rectTransform.anchoredPosition3D; this.rectTransform.anchoredPosition3D = new Vector3(c.x, c.y, easeMethod().x); };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例9: setCanvasPlaySprite

 public LTDescr setCanvasPlaySprite()
 {
     this.type = TweenAction.CANVAS_PLAYSPRITE;
     this.initInternal = ()=>{
         this.uiImage = trans.gameObject.GetComponent<UnityEngine.UI.Image>();
         this.fromInternal.x = 0f;
     };
     this.easeInternal = ()=>{
         newVect = easeMethod();
         val = newVect.x;
         int frame = (int)Mathf.Round( val );
         this.uiImage.sprite = this.sprites[ frame ];
     };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:15,代码来源:LTDescr.cs


示例10: setCanvasGroupAlpha

 public LTDescr setCanvasGroupAlpha()
 {
     this.type = TweenAction.CANVASGROUP_ALPHA;
     this.initInternal = ()=>{this.fromInternal.x = trans.gameObject.GetComponent<CanvasGroup>().alpha;};
     this.easeInternal = ()=>{ this.trans.GetComponent<CanvasGroup>().alpha = easeMethod().x; };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例11: setCanvasMove

 public LTDescr setCanvasMove()
 {
     this.type = TweenAction.CANVAS_MOVE;
     this.initInternal = ()=>{ this.fromInternal = this.rectTransform.anchoredPosition3D; };
     this.easeInternal = ()=>{ this.rectTransform.anchoredPosition3D = easeMethod(); };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例12: setCanvasColor

    public LTDescr setCanvasColor()
    {
        this.type = TweenAction.CANVAS_COLOR;
        this.initInternal = ()=>{
            this.uiImage = trans.gameObject.GetComponent<UnityEngine.UI.Image>();
            if(this.uiImage != null){
                this.setFromColor( this.uiImage.color );
            }else{
                this.setFromColor( Color.white );
            }
        };
        this.easeInternal = ()=>{
            newVect = easeMethod();
            val = newVect.x;
            Color toColor = tweenColor(this, val);
            this.uiImage.color = toColor;
            if (dt!=0f && this._optional.onUpdateColor != null)
                this._optional.onUpdateColor(toColor);

            if(this.useRecursion)
                colorRecursive(this.rectTransform, toColor);
        };
        return this;
    }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:24,代码来源:LTDescr.cs


示例13: setCanvasAlpha

 public LTDescr setCanvasAlpha()
 {
     this.type = TweenAction.CANVAS_ALPHA;
     this.initInternal = ()=>{
         this.uiImage = trans.gameObject.GetComponent<UnityEngine.UI.Image>();
         this.fromInternal.x = this.uiImage != null ? this.uiImage.color.a : 1f;
     };
     this.easeInternal = ()=>{
         newVect = easeMethod();
         val = newVect.x;
         if(this.uiImage!=null){
             Color c = this.uiImage.color; c.a = val; this.uiImage.color = c;
         }
         if(this.useRecursion){
             alphaRecursive( this.rectTransform, val, 0 );
             textAlphaRecursive( this.rectTransform, val);
         }
     };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:20,代码来源:LTDescr.cs


示例14: setValue3

 public LTDescr setValue3()
 {
     this.type = TweenAction.VALUE3;
     this.initInternal = ()=>{};
     this.easeInternal = this.callback;
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例15: setCallbackColor

    public LTDescr setCallbackColor()
    {
        this.type = TweenAction.CALLBACK_COLOR;
        this.initInternal = ()=>{ this.diff = new Vector3(1.0f,0.0f,0.0f); };
        this.easeInternal = ()=>{
            newVect = easeMethod();
            val = newVect.x;
            Color toColor = tweenColor(this, val);

            #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2
            if(this.spriteRen!=null){
                this.spriteRen.color = toColor;
                colorRecursiveSprite( trans, toColor);
            }else{
            #endif
                // Debug.Log("val:"+val+" tween:"+tween+" tween.diff:"+tween.diff);
                if(this.type==TweenAction.COLOR)
                    colorRecursive(trans, toColor, this.useRecursion);

                #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2
            }
                #endif
            if(dt!=0f && this._optional.onUpdateColor!=null){
                this._optional.onUpdateColor(toColor);
            }else if(dt!=0f && this._optional.onUpdateColorObject!=null){
                this._optional.onUpdateColorObject(toColor, this._optional.onUpdateParam);
            }
        };
        return this;
    }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:30,代码来源:LTDescr.cs


示例16: setCanvasRotateAroundLocal

    public LTDescr setCanvasRotateAroundLocal()
    {
        this.type = TweenAction.CANVAS_ROTATEAROUND_LOCAL;
        this.initInternal = this.initCanvasRotateAround;
        this.easeInternal = ()=>{
            newVect = easeMethod();
            val = newVect.x;
            RectTransform rect = this.rectTransform;
            Vector3 origPos = rect.localPosition;
            rect.RotateAround((Vector3)rect.TransformPoint( this._optional.point ), rect.TransformDirection(this._optional.axis), -val);
            Vector3 diff = origPos - rect.localPosition;

            rect.localPosition = origPos - diff; // Subtract the amount the object has been shifted over by the rotate, to get it back to it's orginal position
            rect.rotation = this._optional.origRotation;
            rect.RotateAround((Vector3)rect.TransformPoint( this._optional.point ), rect.TransformDirection(this._optional.axis), val);
        };
        return this;
    }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:18,代码来源:LTDescr.cs


示例17: setColor

    public LTDescr setColor()
    {
        this.type = TweenAction.COLOR;
        this.initInternal = ()=>{
            #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
            if(trans.gameObject.renderer){
            this.setFromColor( trans.gameObject.renderer.material.color );
            }else if(trans.childCount>0){
            foreach (Transform child in trans) {
            if(child.gameObject.renderer!=null){
            this.setFromColor( child.gameObject.renderer.material.color );
            break;
            }
            }
            }
            #else
            SpriteRenderer renColor = trans.gameObject.GetComponent<SpriteRenderer>();
            if(renColor!=null){
                this.setFromColor( renColor.color );
            }else{
                if(trans.gameObject.GetComponent<Renderer>()!=null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_Color")){
                    Color col = trans.gameObject.GetComponent<Renderer>().material.color;
                    this.setFromColor( col );
                }else if(trans.gameObject.GetComponent<Renderer>()!=null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_TintColor")){
                    Color col = trans.gameObject.GetComponent<Renderer>().material.GetColor ("_TintColor");
                    this.setFromColor( col );
                }else if(trans.childCount>0){
                    foreach (Transform child in trans) {
                        if(child.gameObject.GetComponent<Renderer>()!=null){
                            Color col = child.gameObject.GetComponent<Renderer>().material.color;
                            this.setFromColor( col );
                            break;
                        }
                    }
                }
            }
            #endif
        };
        this.easeInternal = ()=>{
            newVect = easeMethod();
            val = newVect.x;
            Color toColor = tweenColor(this, val);

            #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2

            if(this.spriteRen!=null){
                this.spriteRen.color = toColor;
                colorRecursiveSprite( trans, toColor);
            }else{
            #endif
                // Debug.Log("val:"+val+" tween:"+tween+" tween.diff:"+tween.diff);
                if(this.type==TweenAction.COLOR)
                    colorRecursive(trans, toColor, this.useRecursion);

                #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2
            }
                #endif
            if(dt!=0f && this._optional.onUpdateColor!=null){
                this._optional.onUpdateColor(toColor);
            }else if(dt!=0f && this._optional.onUpdateColorObject!=null){
                this._optional.onUpdateColorObject(toColor, this._optional.onUpdateParam);
            }
        };
        return this;
    }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:65,代码来源:LTDescr.cs


示例18: setCanvasScale

 public LTDescr setCanvasScale()
 {
     this.type = TweenAction.CANVAS_SCALE;
     this.initInternal = ()=>{ this.from = this.rectTransform.localScale; };
     this.easeInternal = ()=>{ this.rectTransform.localScale = easeMethod(); };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例19: setGUIAlpha

 public LTDescr setGUIAlpha()
 {
     this.type = TweenAction.GUI_ALPHA;
     this.initInternal = ()=>{ this.fromInternal.x = this._optional.ltRect.alpha; };
     this.easeInternal = ()=>{ this._optional.ltRect.alpha = easeMethod().x; };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs


示例20: setCanvasSizeDelta

 public LTDescr setCanvasSizeDelta()
 {
     this.type = TweenAction.CANVAS_SIZEDELTA;
     this.initInternal = ()=>{ this.from = this.rectTransform.sizeDelta; };
     this.easeInternal = ()=>{ this.rectTransform.sizeDelta = easeMethod(); };
     return this;
 }
开发者ID:AK2S,项目名称:LeanTweenExtensions,代码行数:7,代码来源:LTDescr.cs



注:本文中的TweenAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Tweener类代码示例发布时间:2022-05-24
下一篇:
C# Tween类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap