void MakeBackground() { float thickness = 25f; float distanceBetween = 10f; float borderWidth = Futile.screen.width; float borderHeight = Futile.screen.height; TweenFlow flow = new TweenFlow(); TweenConfig config = new TweenConfig() .floatProp("alpha", 0.15f); float delayBetweenTweenStarts = 0.2f; for (int i = 0; borderWidth > 0 && borderHeight > 0; i++) { TBorderLayer layer = new TBorderLayer(borderWidth, borderHeight, 25f, new Color(0.75f, 0.2f, 0.2f, 1.0f)); layer.x = (distanceBetween + thickness) * i; layer.y = (distanceBetween + thickness) * i; layer.alpha = 0.0f; AddChild(layer); borderWidth = borderWidth - distanceBetween * 2f - thickness * 2f; borderHeight = borderHeight - distanceBetween * 2f - thickness * 2f; flow.insert(delayBetweenTweenStarts * i, new Tween(layer, 0.3f, config)); } Go.addTween(flow); flow.play(); }
void Start() { // create a TweenConfig that we will use on all 4 cubes var config = new TweenConfig() .setEaseType( EaseType.QuadIn ) // set the ease type for the tweens .materialColor( Color.magenta ) // tween the material color to magenta .eulerAngles( new Vector3( 0, 360, 0 ) ) // do a 360 rotation .position( new Vector3( 2, 8, 0 ), true ) // relative position tween so it will be start from the current location .setIterations( 2, LoopType.PingPong ); // 2 iterations with a PingPong loop so we go out and back // create the chain and set it to have 2 iterations var chain = new TweenChain().setIterations( 2 ); // add a completion handler for the chain chain.setOnCompleteHandler( c => Debug.Log( "chain complete" ) ); // create a Tween for each cube and it to the chain foreach( var cube in cubes ) { var tween = new Tween( cube, 0.5f, config ); chain.append( tween ); } _tween = chain; }
void Start() { // create a TweenConfig that we will use on all 4 cubes var config = new TweenConfig() .setEaseType( EaseType.QuadIn ) // set the ease type for the tweens .materialColor( Color.magenta ) // tween the material color to magenta .eulerAngles( new Vector3( 0, 360, 0 ) ) // do a 360 rotation .position( new Vector3( 2, 8, 0 ), true ) // relative position tween so it will be start from the current location .setIterations( 2, LoopType.PingPong ); // 2 iterations with a PingPong loop so we go out and back; // create the flow and set it to have 2 iterations var flow = new TweenFlow().setIterations( 2 ); // add a completion handler for the chain flow.setOnCompleteHandler( c => Debug.Log( "flow complete" ) ); // create a Tween for each cube and it to the flow var startTime = 0f; foreach( var cube in cubes ) { var tween = new Tween( cube, 0.5f, config ); flow.insert( startTime, tween ); // increment our startTime so that the next tween starts when this one is halfway done startTime += 0.25f; } _tween = flow; }
/// <summary> /// helper function that creates a "to" Tween and adds it to the pool /// </summary> public static Tween to(object target, float duration, TweenConfig config) { var tween = new Tween(target, duration, config); addTween(tween); return(tween); }
public RXTweenChain Add(object target, float duration, TweenConfig config) { config.onComplete(HandleTweenComplete); Tween tween = new Tween(target, duration, config, null); tweensToDo.Add(tween); return(this); }
/// <summary> /// helper function that creates a "from" Tween and adds it to the pool /// </summary> public static Tween from(object target, float duration, TweenConfig config) { config.setIsFrom(); var tween = new Tween(target, duration, config); addTween(tween); return(tween); }
void ShrinkMainboxes() { TweenConfig config = new TweenConfig().scaleXY(0).setEaseType(EaseType.ExpoIn).hideWhenComplete(); Go.to(newPlayerBox, 0.3f, config); Go.to(resetBox, 0.3f, config); Go.to(sortBox, 0.3f, config); Go.to(volumeBox, 0.3f, config); }
/// <summary> /// initializes a new instance and sets up the details according to the config parameter /// </summary> public Tween(object target, float duration, TweenConfig config, Action <AbstractTween> onComplete = null) { // default to removing on complete autoRemoveOnComplete = true; this.target = target; this.duration = duration; // copy the TweenConfig info over id = config.id; delay = config.delay; loopType = config.loopType; iterations = config.iterations; _easeType = config.easeType; updateType = config.propertyUpdateType; isFrom = config.isFrom; timeScale = config.timeScale; _onComplete = config.onCompleteHandler; _onStart = config.onStartHandler; if (config.isPaused) { state = TweenState.Paused; } // if onComplete is passed to the constructor it wins. it is left as the final param to allow an inline Action to be // set and maintain clean code (Actions always try to be the last param of a method) if (onComplete != null) { _onComplete = onComplete; } // add all our properties for (var i = 0; i < config.tweenProperties.Count; i++) { var tweenProp = config.tweenProperties[i]; // if the tween property is initialized already it means it is being reused so we need to clone it if (tweenProp.isInitialized) { tweenProp = tweenProp.clone(); } addTweenProperty(tweenProp); } // calculate total duration if (iterations < 0) { totalDuration = float.PositiveInfinity; } else { totalDuration = iterations * duration; } }
void MakeUIElements() { scoreLabel = new FLabel("SoftSugar", "0"); scoreLabel.anchorX = 1.0f; scoreLabel.anchorY = 1.0f; scoreLabel.scale = 0.75f; scoreLabel.x = Futile.screen.width + scoreLabel.textRect.width; scoreLabel.y = Futile.screen.height - 10f; scoreLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); AddChild(scoreLabel); missedLabel = new FLabel("SoftSugar", "Misses left: 0"); missedLabel.anchorX = 0.0f; missedLabel.anchorY = 1.0f; missedLabel.scale = 0.75f; missedLabel.x = -missedLabel.textRect.width; missedLabel.y = Futile.screen.height - 10f; missedLabel.color = new Color(0.75f, 0.12f, 0.12f, 1.0f); AddChild(missedLabel); startLabel1 = new FLabel("SoftSugar", "How much do I love you?"); startLabel2 = new FLabel("SoftSugar", "Click the hearts to find out,\nbut don't miss too many!"); startLabel1.color = new Color(0.75f, 0.12f, 0.12f, 1.0f); startLabel2.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); float adj = 40f; startLabel1.x = startLabel2.x = Futile.screen.halfWidth; startLabel1.y = Futile.screen.halfHeight + adj; startLabel2.y = startLabel1.y - startLabel1.textRect.height / 2f - startLabel2.textRect.height / 2f - 10f + adj; startLabel1.scale = startLabel2.scale = 0; AddChild(startLabel1); AddChild(startLabel2); TweenConfig config1 = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut); TweenConfig config2 = new TweenConfig() .floatProp("scale", 0.5f) .setEaseType(EaseType.SineInOut); float duration = 0.5f; TweenChain chain = new TweenChain(); chain.append(new Tween(startLabel1, duration, config1)); chain.append(new Tween(startLabel2, duration, config2)); chain.setOnCompleteHandler(OnGameShouldBeReadyToStart); Go.addTween(chain); chain.play(); }
void UnshrinkMainboxes() { newPlayerBox.isVisible = true; resetBox.isVisible = true; sortBox.isVisible = true; volumeBox.isVisible = true; TweenConfig config = new TweenConfig().scaleXY(1.0f).setDelay(0.4f).setEaseType(EaseType.ExpoOut); Go.to(newPlayerBox, 0.3f, config); Go.to(resetBox, 0.3f, config); Go.to(sortBox, 0.3f, config); Go.to(volumeBox, 0.3f, config); }
public void Destroy() { TweenConfig alphaTweenConfig = new TweenConfig(); alphaTweenConfig.addTweenProperty(new FloatTweenProperty("alpha", 0.0f, false)); TweenConfig scaleTweenConfig = new TweenConfig(); scaleTweenConfig.addTweenProperty(new FloatTweenProperty("scale", 20, false)); Tween alphaTween = new Tween(this, 0.3f, alphaTweenConfig); Tween scaleTween = new Tween(this, 0.3f, scaleTweenConfig); TweenFlow tweenFlow = new TweenFlow(); tweenFlow.insert(0.0f, alphaTween); tweenFlow.insert(0.0f, scaleTween); tweenFlow.setOnCompleteHandler(DoneDestroying); tweenFlow.play(); }
/* void Update() { if ( focused == true ) return; prevPosition = transform.position; transform.position = Mathfx.Round( GameManager.cursorInfo.point ); if ( prevPosition == transform.position ) return; }*/ void Animate() { if ( animating ) return; foreach ( HighlightCorner c in corners ) { if ( c.tween != null ) continue; TweenConfig tc = new TweenConfig().scale( new Vector3( 0.6f , 0.75f , 0.6f ) ).setEaseType( EaseType.CircIn ).setIterations( -1 );//.setDelay( animateSpeed * 0.5f ); tc.loopType = LoopType.PingPong; if ( c.tween != null ) c.tween.destroy(); c.tween = Go.to( c.transform , animateSpeed , tc ); } animating = true; }
/// <summary> /// initializes a new instance and sets up the details according to the config parameter /// </summary> public Tween( object target, float duration, TweenConfig config, Action<AbstractTween> onComplete = null ) { // default to removing on complete autoRemoveOnComplete = true; this.target = target; this.duration = duration; // copy the TweenConfig info over id = config.id; delay = config.delay; loopType = config.loopType; iterations = config.iterations; _easeType = config.easeType; updateType = config.propertyUpdateType; isFrom = config.isFrom; timeScale = config.timeScale; _onComplete = config.onCompleteHandler; _onStart = config.onStartHandler; if( config.isPaused ) state = TweenState.Paused; // if onComplete is passed to the constructor it wins. it is left as the final param to allow an inline Action to be // set and maintain clean code (Actions always try to be the last param of a method) if( onComplete != null ) _onComplete = onComplete; // add all our properties for( var i = 0; i < config.tweenProperties.Count; i++ ) { var tweenProp = config.tweenProperties[i]; // if the tween property is initialized already it means it is being reused so we need to clone it if( tweenProp.isInitialized ) tweenProp = tweenProp.clone(); addTweenProperty( tweenProp ); } // calculate total duration if( iterations < 0 ) totalDuration = float.PositiveInfinity; else totalDuration = iterations * duration; }
public void Destroy() { TweenConfig alphaTweenConfig = new TweenConfig(); alphaTweenConfig.addTweenProperty(new FloatTweenProperty("alpha", 0.0f, false)); TweenConfig scaleTweenConfig = new TweenConfig(); scaleTweenConfig.addTweenProperty(new FloatTweenProperty("scale", 20, false)); Tween alphaTween = new Tween(this, 0.3f, alphaTweenConfig); Tween scaleTween = new Tween(this, 0.3f, scaleTweenConfig); TweenFlow tweenFlow = new TweenFlow(); tweenFlow.insert(0.0f, alphaTween); tweenFlow.insert(0.0f, scaleTween); tweenFlow.setOnCompleteHandler(DoneDestroying); tweenFlow.play(); }
/* * void Update() * { * if ( focused == true ) * return; * * prevPosition = transform.position; * transform.position = Mathfx.Round( GameManager.cursorInfo.point ); * * if ( prevPosition == transform.position ) * return; * * }*/ void Animate() { if (animating) { return; } foreach (HighlightCorner c in corners) { if (c.tween != null) { continue; } TweenConfig tc = new TweenConfig().scale(new Vector3(0.6f, 0.75f, 0.6f)).setEaseType(EaseType.CircIn).setIterations(-1); //.setDelay( animateSpeed * 0.5f ); tc.loopType = LoopType.PingPong; if (c.tween != null) { c.tween.destroy(); } c.tween = Go.to(c.transform, animateSpeed, tc); } animating = true; }
public static TweenConfig expoInOut(this TweenConfig config) { config.easeType = EaseType.ExpoInOut; return(config); }
public void Apply_Effect(int index) { TweenConfig config = tweenConfigs[index]; LTDescr tweenDescr = null; Vector3 v3a, v3b; switch (config.type) { case TweenType.None: break; case TweenType.Move: switch (config.para) { case TweenPara.None: break; case TweenPara.Zero_To_One: break; case TweenPara.One_To_Zero: break; case TweenPara.FloatA_To_FloatB: break; case TweenPara.VectA_To_VectB: if (!config.use_curVal_as_A) { transform.position = config.vec_A; } tweenDescr = LeanTween.move(gameObject, config.vec_B, config.duration); break; case TweenPara.ColA_To_ColB: break; case TweenPara.ViewA_To_ViewB: if (!config.use_curVal_as_A) { v3a = Cam.ViewportToWorldPoint(config.vPrt_A); v3a.z = transform.position.z; transform.position = v3a; } v3b = Cam.ViewportToWorldPoint(config.vPrt_B); v3b.z = transform.position.z; tweenDescr = LeanTween.move(gameObject, v3b, config.duration).setEase(config.curve); break; default: break; } break; case TweenType.MoveUI: RectTransform rt = GetComponent <RectTransform>(); switch (config.para) { case TweenPara.None: break; case TweenPara.Zero_To_One: break; case TweenPara.One_To_Zero: break; case TweenPara.FloatA_To_FloatB: break; case TweenPara.VectA_To_VectB: if (!config.use_curVal_as_A) { transform.position = config.vec_A; } tweenDescr = LeanTween.move(gameObject, config.vec_B, config.duration); break; case TweenPara.ColA_To_ColB: break; case TweenPara.ViewA_To_ViewB: CanvasScaler cs = GetComponentInParent <CanvasScaler>(); RectTransform crt = cs.GetComponent <RectTransform>(); if (!config.use_curVal_as_A) { v3a.x = crt.rect.width * config.vPrt_A.x * crt.localScale.x; v3a.y = crt.rect.height * config.vPrt_A.y * crt.localScale.y; v3a.z = transform.position.z; transform.position = v3a; } v3b.x = crt.rect.width * config.vPrt_B.x * crt.localScale.x; v3b.y = crt.rect.height * config.vPrt_B.y * crt.localScale.y; v3b.z = transform.position.z; tweenDescr = LeanTween.move(gameObject, v3b, config.duration).setEase(config.curve); break; default: break; } break; case TweenType.Rotate: break; case TweenType.Scale: break; case TweenType.ColorMat: break; case TweenType.ColorVtx: break; default: break; } if (tweenDescr != null) { tweenDescr.setOnStart(() => { config.onStart.Invoke(); }); tweenDescr.setOnComplete(() => { config.onComplete.Invoke(); }); } }
public static TweenConfig scaleXY(this TweenConfig config, float scale) { config.tweenProperties.Add(new FloatTweenProperty("scale", scale, false)); return(config); }
public static TweenConfig backIn(this TweenConfig config) { config.easeType = EaseType.BackIn; return(config); }
public void EndGame() { FlyOutUIElements(); scoreLabel.text = string.Format("{0:#,###0}", score); for (int i = hearts.Count - 1; i >= 0; i--) { FSprite heart = hearts[i]; foreach (AbstractTween tween in Go.tweensWithTarget(heart)) Go.removeTween(tween); heart.RemoveFromContainer(); hearts.Remove(heart); } if (score >= 1000000) { StartHeartShower(); FSoundManager.StopMusic(); FSoundManager.PlaySound("happyPiano"); gameIsOver = true; FLabel label = new FLabel("SoftSugar", "I love you times a million!"); label.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); label.x = Futile.screen.halfWidth; label.y = Futile.screen.halfHeight; label.scale = 0; AddChild(label); TweenConfig config = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut) .onComplete(OnWinLabelDoneAppearing); Go.to(label, 0.5f, config); } if (numHeartsMissed >= 5) { gameIsOver = true; FSoundManager.StopMusic(); FSoundManager.PlaySound("sadPiano"); FLabel topLabel = new FLabel("SoftSugar", "Are you kidding me?!"); FLabel bottomLabel = new FLabel("SoftSugar", string.Format("I love you way more than x{0:#,###0}!", score)); topLabel.color = new Color(0.75f, 0.12f, 0.12f, 1.0f); bottomLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); bottomLabel.x = topLabel.x = Futile.screen.halfWidth; float bottomBeginning = 300f; float segmentHeight = (Futile.screen.height - bottomBeginning * 2f) / 3f; bottomLabel.y = segmentHeight - bottomLabel.textRect.height / 2f + bottomBeginning; topLabel.y = segmentHeight * 3f - topLabel.textRect.height / 2f + bottomBeginning; bottomLabel.scale = topLabel.scale = 0; AddChild(topLabel); AddChild(bottomLabel); TweenConfig config1 = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut); TweenConfig config2 = new TweenConfig() .floatProp("scale", 0.75f) .setEaseType(EaseType.SineInOut); float duration = 0.5f; TweenChain chain = new TweenChain(); chain.append(new Tween(topLabel, duration, config1)); chain.append(new Tween(bottomLabel, duration, config2)); chain.setOnCompleteHandler(OnGameShouldBeFullyOver); Go.addTween(chain); chain.play(); } }
public void CallGameOver() { player.RemoveFromContainer(); TweenConfig tw = new TweenConfig(); tw.floatProp("alpha", 0); tw.onComplete(theTween => { Game.instance.GoToPage(PageType.MenuPage); }); Go.to(this, 2f, tw); }
void UnshrinkMainboxes() { newPlayerBox.isVisible = true; resetBox.isVisible = true; sortBox.isVisible = true; volumeBox.isVisible = true; TweenConfig config = new TweenConfig().scaleXY(1.0f).setDelay(0.4f).setEaseType(EaseType.ExpoOut); Go.to(newPlayerBox, 0.3f,config); Go.to(resetBox, 0.3f,config); Go.to(sortBox, 0.3f,config); Go.to(volumeBox, 0.3f,config); }
public void EndGame() { FlyOutUIElements(); scoreLabel.text = string.Format("{0:#,###0}", score); for (int i = hearts.Count - 1; i >= 0; i--) { FSprite heart = hearts[i]; foreach (AbstractTween tween in Go.tweensWithTarget(heart)) { Go.removeTween(tween); } heart.RemoveFromContainer(); hearts.Remove(heart); } if (score >= 1000000) { StartHeartShower(); FSoundManager.StopMusic(); FSoundManager.PlaySound("happyPiano"); gameIsOver = true; FLabel label = new FLabel("SoftSugar", "I love you times a million!"); label.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); label.x = Futile.screen.halfWidth; label.y = Futile.screen.halfHeight; label.scale = 0; AddChild(label); TweenConfig config = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut) .onComplete(OnWinLabelDoneAppearing); Go.to(label, 0.5f, config); } if (numHeartsMissed >= 5) { gameIsOver = true; FSoundManager.StopMusic(); FSoundManager.PlaySound("sadPiano"); FLabel topLabel = new FLabel("SoftSugar", "Are you kidding me?!"); FLabel bottomLabel = new FLabel("SoftSugar", string.Format("I love you way more than x{0:#,###0}!", score)); topLabel.color = new Color(0.75f, 0.12f, 0.12f, 1.0f); bottomLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); bottomLabel.x = topLabel.x = Futile.screen.halfWidth; float bottomBeginning = 300f; float segmentHeight = (Futile.screen.height - bottomBeginning * 2f) / 3f; bottomLabel.y = segmentHeight - bottomLabel.textRect.height / 2f + bottomBeginning; topLabel.y = segmentHeight * 3f - topLabel.textRect.height / 2f + bottomBeginning; bottomLabel.scale = topLabel.scale = 0; AddChild(topLabel); AddChild(bottomLabel); TweenConfig config1 = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut); TweenConfig config2 = new TweenConfig() .floatProp("scale", 0.75f) .setEaseType(EaseType.SineInOut); float duration = 0.5f; TweenChain chain = new TweenChain(); chain.append(new Tween(topLabel, duration, config1)); chain.append(new Tween(bottomLabel, duration, config2)); chain.setOnCompleteHandler(OnGameShouldBeFullyOver); Go.addTween(chain); chain.play(); } }
public static TweenConfig removeWhenComplete(this TweenConfig config) { config.onComplete(HandleRemoveWhenDoneTweenComplete); return(config); }
public static TweenConfig destroyWhenComplete(this TweenConfig config) { config.onComplete((tween) => { ((tween as Tween).target as SKDestroyable).Destroy(); }); return(config); }
public static TweenConfig removeWhenComplete(this TweenConfig config) { config.onComplete((tween) => { ((tween as Tween).target as FNode).RemoveFromContainer(); }); return(config); }
//this makes it so we don't have to specify false for isRelative every.single.time. public static TweenConfig colorProp(this TweenConfig config, string propName, Color propValue) { return(config.colorProp(propName, propValue, false)); }
void loadTiles() { foreach (PlatformData platform in levelData.getPlatformData()) { FSprite plat = new FSprite(platform.image); plat.height = 16; plat.width = 16; tileSize = plat.width; Tiles[(int)platform.x, (int)platform.y] = 1; // make them overlap a little to avoid those ungly lines in the rendering. plat.SetPosition(new Vector2((platform.x * plat.width), (-platform.y * plat.height))); AddChild(plat); } playerBullets = new List<Bullet>(); hazards = new List<Hazard>(); particleContainer = new FContainer(); AddChild(particleContainer); enemyContainer = new FContainer(); AddChild(enemyContainer); particles = new FParticleSystem(50); particleContainer.AddChild(particles); projectileContainer = new FContainer(); AddChild(projectileContainer); entityContainer = new FContainer(); AddChild(entityContainer); frontContainer = new FContainer(); AddChild(frontContainer); this.alpha = 0; TweenConfig tw = new TweenConfig(); tw.floatProp("alpha", 1); Go.to(this, 10f, tw); stats = new FLabel("font", "Jump Packs: 0; reload times: 0"); CurrentPage.GetHUD().AddChild(stats); stats.scale = 0.9f; stats.SetPosition(new Vector2(Futile.screen.halfWidth, Futile.screen.height * 0.9f)); }
/// <summary> /// helper function that creates a "from" Tween and adds it to the pool /// </summary> public static Tween from( object target, float duration, TweenConfig config ) { config.setIsFrom(); var tween = new Tween( target, duration, config ); addTween( tween ); return tween; }
void MakeUIElements() { scoreLabel = new FLabel("SoftSugar", "0"); scoreLabel.anchorX = 1.0f; scoreLabel.anchorY = 1.0f; scoreLabel.scale = 0.75f; scoreLabel.x = Futile.screen.width + scoreLabel.textRect.width; scoreLabel.y = Futile.screen.height - 10f; scoreLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); AddChild(scoreLabel); missedLabel = new FLabel("SoftSugar", "Misses left: 0"); missedLabel.anchorX = 0.0f; missedLabel.anchorY = 1.0f; missedLabel.scale = 0.75f; missedLabel.x = -missedLabel.textRect.width; missedLabel.y = Futile.screen.height - 10f; missedLabel.color = new Color(0.75f, 0.12f, 0.12f, 1.0f); AddChild(missedLabel); startLabel1 = new FLabel("SoftSugar", "How much do I love you?"); startLabel2 = new FLabel("SoftSugar", "Click the hearts to find out,\nbut don't miss too many!"); startLabel1.color = new Color(0.75f, 0.12f, 0.12f, 1.0f); startLabel2.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); float adj = 40f; startLabel1.x = startLabel2.x = Futile.screen.halfWidth; startLabel1.y = Futile.screen.halfHeight + adj; startLabel2.y = startLabel1.y - startLabel1.textRect.height / 2f - startLabel2.textRect.height / 2f - 10f + adj; startLabel1.scale = startLabel2.scale = 0; AddChild(startLabel1); AddChild(startLabel2); TweenConfig config1 = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut); TweenConfig config2 = new TweenConfig() .floatProp("scale", 0.5f) .setEaseType(EaseType.SineInOut); float duration = 0.5f; TweenChain chain = new TweenChain(); chain.append(new Tween(startLabel1, duration, config1)); chain.append(new Tween(startLabel2, duration, config2)); chain.setOnCompleteHandler(OnGameShouldBeReadyToStart); Go.addTween(chain); chain.play(); }
void ShrinkMainboxes() { TweenConfig config = new TweenConfig().scaleXY(0).setEaseType(EaseType.ExpoIn).hideWhenComplete(); Go.to(newPlayerBox, 0.3f,config); Go.to(resetBox, 0.3f,config); Go.to(sortBox, 0.3f,config); Go.to(volumeBox, 0.3f,config); }
public static TweenConfig pos(this TweenConfig config, float x, float y) { config.tweenProperties.Add(new FloatTweenProperty("x", x, false)); config.tweenProperties.Add(new FloatTweenProperty("y", y, false)); return(config); }
//this makes it so we don't have to specify false for isRelative every.single.time. public static TweenConfig floatProp(this TweenConfig config, string propName, float propValue) { return(config.floatProp(propName, propValue, false)); }
public static TweenConfig pos(this TweenConfig config, Vector2 pos) { config.tweenProperties.Add(new FloatTweenProperty("x", pos.x, false)); config.tweenProperties.Add(new FloatTweenProperty("y", pos.y, false)); return(config); }
public static TweenConfig hideWhenComplete(this TweenConfig config) { config.onComplete((tween) => { ((tween as Tween).target as FNode).isVisible = false; }); return(config); }
public void To(float targetAmount, float duration, TweenConfig tc) { Go.killAllTweensWithTarget(this); tc.floatProp("amount", targetAmount); Go.to(this, duration, tc); }
private void BrickDeath(Brick brick) { brick.BeingKilled = true; fContainerDeath.AddChild(brick); TweenConfig tweenConfig = new TweenConfig() .floatProp("scale", 1.6f) .floatProp("alpha", 0.5f) .colorProp("color", new Color(1, 1, 1, 1)) .onComplete(BrickDead); brick.Tween = Go.to(brick, timeToKillMatch, tweenConfig); }
//forward to an action with no arguments instead (ex you can pass myNode.RemoveFromContainer) public static TweenConfig onComplete(this TweenConfig config, Action onCompleteAction) { config.onComplete((tween) => { onCompleteAction(); }); return(config); }
public static TweenConfig alpha(this TweenConfig config, float alpha) { config.tweenProperties.Add(new FloatTweenProperty("alpha", alpha, false)); return(config); }
public static TweenConfig rotation(this TweenConfig config, float rotation) { config.tweenProperties.Add(new FloatTweenProperty("rotation", rotation, false)); return(config); }
/// <summary> /// helper function that creates a "to" Tween and adds it to the pool /// </summary> public static Tween to( object target, float duration, TweenConfig config ) { var tween = new Tween( target, duration, config ); addTween( tween ); return tween; }
void MakeBackground() { float thickness = 25f; float distanceBetween = 10f; float borderWidth = Futile.screen.width; float borderHeight = Futile.screen.height; TweenFlow flow = new TweenFlow(); TweenConfig config = new TweenConfig() .floatProp("alpha", 0.15f); float delayBetweenTweenStarts = 0.2f; for (int i = 0; borderWidth > 0 && borderHeight > 0; i++) { TBorderLayer layer = new TBorderLayer(borderWidth, borderHeight, 25f, new Color(0.75f, 0.2f, 0.2f, 1.0f)); layer.x = (distanceBetween + thickness) * i; layer.y = (distanceBetween + thickness) * i; layer.alpha = 0.0f; AddChild(layer); borderWidth = borderWidth - distanceBetween * 2f - thickness * 2f; borderHeight = borderHeight - distanceBetween * 2f - thickness * 2f; flow.insert(delayBetweenTweenStarts * i, new Tween(layer, 0.3f, config)); } Go.addTween(flow); flow.play(); }