public AnimGroup AddAnimation(FadeAnimation ta) { TimeStart = Mathf.Min(TimeStart, ta.TimeStart); TimeEnd = Mathf.Max(TimeEnd, ta.TimeEnd); FadeAnimations.Add(ta); return(this); }
private void Start() { fadeTime = FadeAnimation.Instance.valueFadeTime(); fadeAnm = GameObject.Find("SceneFadeSystem").GetComponent <FadeAnimation>(); pauseUi = GameObject.Find("PauseCanvas"); pauseButton = GameObject.Find("PauseButton"); }
private void TransitionMainText(SceneTransitionRequest str, Image anchorTarget) { var animGroup = new AnimGroup(); var textFadeOut = new FadeAnimation(PhraseText, Time.time, FadeOutDuration, FadeOutCurve, 0.0f); animGroup.AddAnimation(textFadeOut); var lastAnimFinish = textFadeOut.TimeEnd; var defaultTextBoxSize = new Vector2(anchorTarget.rectTransform.rect.width - 30, anchorTarget.rectTransform.rect.height - 35); var requiredHeight = GetDesiredTextHeight(PhraseText, str.TransitionPhrase, defaultTextBoxSize); if (PhraseBackground.rectTransform.anchoredPosition != anchorTarget.rectTransform.anchoredPosition || !Mathf.Approximately(requiredHeight, PhraseText.rectTransform.rect.height)) { var textBoxResize = new RectAnimation(PhraseBackground.rectTransform, textFadeOut.TimeEnd, TransitionDuration, TransitionCurve, anchorTarget.rectTransform); // Fixup for correct size textBoxResize.TargetSize.y = requiredHeight + 35; animGroup.AddAnimation(textBoxResize); lastAnimFinish = textBoxResize.TimeEnd; } var textChange = new SetTextAnimation(PhraseText, lastAnimFinish, str.TransitionPhrase); animGroup.AddAnimation(textChange); var textFadeIn = new FadeAnimation(PhraseText, lastAnimFinish, FadeInDuration, FadeInCurve, 1.0f); animGroup.AddAnimation(textFadeIn); _pendingAnimations.Enqueue(animGroup); }
public void Fade() { boardNodeAnimation = new FadeAnimation(this, fadeDuration); getBoard().boardMatrix[posX, posY] = null; getBoard().canMove = true; isAnimating = true; }
public void Appear() { g_rotation = RANDOM.NextDouble() * 90d - 45d; g_pos_x = RANDOM.NextDouble() * 160d - 80d; g_pos_y = RANDOM.NextDouble() * 240d - 120d; if (_SpriteType == Control.SpriteType.Photo) { g_scale = 1d; double from_x = RANDOM.Next(2) == 0 ? -imageWidthInitial : App.SCREEN_WIDTH + imageWidthInitial; double from_y = RANDOM.Next(2) == 0 ? -imageHeightInitial : App.SCREEN_HEIGHT + imageHeightInitial; RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION); MoveAnimation.MoveFromTo(contentPanel, from_x, from_y, g_pos_x, g_pos_y, APPEAR_DURATION, EASING, fe => { PrepareForManipulation(); }); } else if (_SpriteType == Control.SpriteType.Material || _SpriteType == Control.SpriteType.Text) { g_scale = RANDOM.NextDouble() * 0.3d + 0.8d; MoveAnimation.SetPosition(contentPanel, g_pos_x, g_pos_y); FadeAnimation.Fade(contentPanel, 0d, 1d, APPEAR_DURATION); RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION); ScaleAnimation.ScaleFromTo(contentPanel, 1.5d, 1.5d, g_scale, g_scale, APPEAR_DURATION, fe => { ScaleAnimation.SetScale(fe, 1d, 1d); PrepareForManipulation(); }); } }
void Start() { _cr = GetComponent<CanvasRenderer>(); _fa = GetComponent<FadeAnimation>(); _fa.setAlpha(0f); }
public Player(int number) { this.axisManager = new AxisManager(); this.number = number; this.frame = GameObject.FindGameObjectWithTag("Frame" + this.number).GetComponent <Image>(); this.selectedCharacterImage = GameObject.FindGameObjectWithTag("SelectedCharacterImage" + this.number).GetComponent <Image>(); switch (number) { case 0: this.color = new Color(0, 0, 1F, 1F); this.xCharacterSelected = 0; this.yCharacterSelected = 2; break; case 1: this.color = new Color(1F, 0, 0, 1F); this.xCharacterSelected = 2; this.yCharacterSelected = 2; break; case 2: this.color = new Color(0, 1F, 0, 1F); this.xCharacterSelected = 0; this.yCharacterSelected = 0; break; case 3: this.color = new Color(1F, 1F, 0, 1F); this.xCharacterSelected = 2; this.yCharacterSelected = 2; break; } this.fadeAnimation = new FadeAnimation(this.color, 0.3f, 1.3f, 0.07f); }
private void Start() { joybutton = FindObjectOfType <JoyButtonAction> (); fade = FadeAnimation.current; blockLimitDialog = "Blocos insuficientes para este desafio"; puzzleCompletedDialog = "Desafio concluido"; }
private void Start() { if (instance == null) { instance = this; } DontDestroyOnLoad(gameObject); }
private void StartEditList() { listEditing = true; MoveAnimation.MoveTo(this.myThemeListBox, 0d, 0d, 200d, easingFunction, fe => { }); FadeAnimation.Fade(this.switchMask, 0d, 1d, 200d); BuildBottomAppBar_Edit(); }
/// <summary> /// /// </summary> /// <param name="element">WPF control element (tile)</param> /// <param name="fadeInDuration">ms</param> /// <param name="fadeOutDuration">ms</param> /// <param name="stayDuration">ms</param> public TileStoryboard(UIElement element, long fadeInDuration, long fadeOutDuration, long stayDuration) { this.RepeatBehavior = new RepeatBehavior(1); FadeAnimation fadeIn = new FadeAnimation(FadeAnimation.FadeType.In, fadeInDuration, element); this.AddChild(fadeIn); FadeAnimation fadeOut = new FadeAnimation(FadeAnimation.FadeType.Out, fadeOutDuration, element); fadeOut.BeginTime = new TimeSpan((fadeInDuration + stayDuration) * 1000 * 10); this.AddChild(fadeOut); }
private void EndEditList() { MoveAnimation.MoveTo(this.myThemeListBox, -64d, 0d, 200d, easingFunction, null); FadeAnimation.Fade(this.switchMask, 1d, 0d, 200d); foreach (var theme in myThemeData.myThemes) { theme.Selected = false; } BuildBottomAppBar_Normal(); listEditing = false; }
public void Fade(float duration, float from, float to, float delay = 0, Action callback = null) { FadeAnimation.Stop(); FadeAnimation.SetDuration(duration) .SetDelay(delay) .SetEaseType(Ease.Type.Linear) .SetAlpha(from, to); FadeAnimation.Play(() => { if (callback != null) { callback(); callback = null; } }); }
/// <summary> /// Coroutine: Runs durring a room transition /// </summary> /// <param name="fade"></param> /// <returns></returns> private IEnumerator CoGenerateAndMoveScreenPlayer(FadeAnimation fade) { //The world-space player SpriteRenderer worldSpacePlayerRenderer = this.GetPlayer().GetComponent <SpriteRenderer>(); //The player that is rendered on the canvas Image screenSpacePlayer = Commons.ScreenSpacePlayer; /* * Load next level and slide the player */ //Controls the speed of the sliding animation const float MOVE_SPEED = 2.5f; //The position the animation will start at (old player position) Vector2 startPosition = Camera.main.WorldToScreenPoint(worldSpacePlayerRenderer.transform.position); //Load next level Commons.RoomGenerator.GenerateNext(); yield return(new WaitForEndOfFrame()); //The position the animation will end at (new player position) Vector2 endPosition = Camera.main.WorldToScreenPoint(this.GetPlayer().transform.position); //Execute animation for (float i = 0; i < 1f; i += MOVE_SPEED * Time.unscaledDeltaTime) { screenSpacePlayer.transform.position = Vector3.Lerp( a: startPosition, b: endPosition, t: i ); yield return(new WaitForEndOfFrame()); } /* * Reset */ //Set origin of the iris-in fade.FadeMask.transform.position = screenSpacePlayer.transform.position; //Hide the screen-space player screenSpacePlayer.transform.position = new Vector3(99999f, 99999f); }
private void FadeAnimation() { foreach (var s in ParentSurface.RenderableSeries) { if (s is BaseRenderableSeries series) { var trans = new FadeAnimation(); trans.Duration = TimeSpan.FromSeconds(5); trans.AnimationDelay = TimeSpan.FromSeconds(1); trans.EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }; series.SeriesAnimation = trans; } } }
public IEnumerator PlayKeyAnimation() { PlayerController player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); FadeAnimation.SetBool("Fade", true); yield return(new WaitUntil(() => FadeImage.color.a == 1)); FadeAnimation.SetBool("Fade", false); player.PlayerCamera.SetActive(false); m_FocusCamera.SetActive(true); m_KeyAnimationObject.SetActive(true); yield return(new WaitForEndOfFrame()); yield return(new WaitForSeconds(10)); SceneManager.LoadScene("Outro"); }
// Use this for initialization void Start() { this.indexSelected = 0; GameObject modeContainer = GameObject.FindGameObjectWithTag("ModeContainer"); tabMode = modeContainer.GetComponentsInChildren <Text>(); listColor = new List <Color>(); //Add Red, Green, Blue, Violet listColor.Add(new Color(1F, 0, 0, 1)); listColor.Add(new Color(0, 0.8F, 0, 1)); listColor.Add(new Color(0, 0, 1F, 1)); //Init Text Color for (int i = 0; i < tabMode.Length; i++) { tabMode[i].color = listColor[i]; } fadeAnimation = new FadeAnimation(listColor[indexSelected], 0.3F, 1.2F, 0.07F); }
/// <summary> /// Coroutine: Runs before a room transition /// </summary> /// <param name="fade"></param> /// <returns></returns> private IEnumerator CoGenerateAndMoveScreenPlayerPre(FadeAnimation fade) { //The world-space player SpriteRenderer worldSpacePlayerRenderer = this.GetPlayer().GetComponent <SpriteRenderer>(); //The player that is rendered on the canvas Image screenSpacePlayer = Commons.ScreenSpacePlayer; /* * Set sprite and size of screen-space player */ //Give the screen-space player the same sprite as the current frame of the actual player's animation screenSpacePlayer.sprite = worldSpacePlayerRenderer.sprite; //Calculate the bounds of the player in screen-space coordinates var screenBoundsMin = Camera.main.WorldToScreenPoint(worldSpacePlayerRenderer.bounds.min); var screenBoundsMax = Camera.main.WorldToScreenPoint(worldSpacePlayerRenderer.bounds.max); //Apply the screen-size of the actual player to the screen space player screenSpacePlayer.rectTransform.sizeDelta = new Vector2(Mathf.Abs(screenBoundsMax.x - screenBoundsMin.x), Mathf.Abs(screenBoundsMax.y - screenBoundsMin.y)); //Flip the player if need be var imageFlipped = worldSpacePlayerRenderer.flipX ^ FlipCamera.IsFlipped; if (imageFlipped) { screenSpacePlayer.transform.localScale = screenSpacePlayer.transform.localScale.SetX(-screenSpacePlayer.transform.localScale.x); } //Set position of the iris-out fade.FadeMask.transform.position = Camera.main.WorldToScreenPoint(worldSpacePlayerRenderer.transform.position); Time.timeScale = 0f; yield break; }
/// <summary> /// Fades the screen, generates the level, moves the player and then fades in /// </summary> public void CreateTransitionToNextRoom() { FadeAnimation fade = FindObjectOfType <FadeAnimation>(); fade.BeginFade(() => CoGenerateAndMoveScreenPlayer(fade), () => CoGenerateAndMoveScreenPlayerPre(fade), CoGenerateAndMoveScreenPlayerPost); }
private void Start() { fade = FadeAnimation.current; }
public void Match(GRP_ManagerBase source) { backgroundImage = source.backgroundImage; backgroundTint = source.backgroundTint; bodyFont = source.bodyFont; bodyFontSize = source.bodyFontSize; bodyTextColor = source.bodyTextColor; buttonBleed = source.buttonBleed; buttonDirection = source.buttonDirection; buttonFont = source.buttonFont; buttonFontSize = source.buttonFontSize; buttonImage = source.buttonImage; buttonPadding = source.buttonPadding; buttonPrefixImage = source.buttonPrefixImage; buttonPressedImage = source.buttonPressedImage; buttonSeparation = source.buttonSeparation; buttonSeparator = source.buttonSeparator; buttonTextColor = source.buttonTextColor; buttonTextColorPressed = source.buttonTextColorPressed; container = source.container; containerBleed = source.containerBleed; containerImage = source.containerImage; containerPadding = source.containerPadding; containerTint = source.containerTint; fadeAnimation = source.fadeAnimation; fadeDuration = source.fadeDuration; fadeProfile = source.fadeProfile; flexibleHeight = source.flexibleHeight; flexibleWidth = source.flexibleWidth; fullscreenBottom = source.fullscreenBottom; fullscreenLeft = source.fullscreenLeft; fullscreenRight = source.fullscreenRight; fullscreenTop = source.fullscreenTop; generalButtonPressedTint = source.generalButtonPressedTint; generalButtonTint = source.generalButtonTint; initialize = source.initialize; makeThisParent = source.makeThisParent; messagePadding = source.messagePadding; placement = source.placement; promptInputFieldImage = source.promptInputFieldImage; promptInputFieldTint = source.promptInputFieldTint; promptInputfieldColor = source.promptInputfieldColor; promptPlaceholderColor = source.promptPlaceholderColor; promptType = source.promptType; referenceSize = source.referenceSize; returnButtonImage = source.returnButtonImage; returnButtonPressedImage = source.returnButtonPressedImage; returnButtonPressedTint = source.returnButtonPressedTint; returnButtonTint = source.returnButtonTint; returnPosition = source.returnPosition; returnTextColor = source.returnTextColor; returnTextColorPressed = source.returnTextColorPressed; showBehaviour = source.showBehaviour; showButtons = source.showButtons; showDesign = source.showDesign; showRatios = source.showRatios; showTypography = source.showTypography; staticAnchor = source.staticAnchor; staticAnchorX = source.staticAnchorX; staticAnchorY = source.staticAnchorY; staticHeight = source.staticHeight; staticWidth = source.staticWidth; staticX = source.staticX; staticY = source.staticY; textAlignment = source.textAlignment; titleColor = source.titleColor; titleFont = source.titleFont; titleFontSize = source.titleFontSize; titlePadding = source.titlePadding; titleSeparator = source.titleSeparator; worldFollowAxes = source.worldFollowAxes; worldHeight = source.worldHeight; worldPosition = source.worldPosition; worldRotation = source.worldRotation; worldScale = source.worldScale; worldWidth = source.worldWidth; }