Skip to content
This repository has been archived by the owner on Jun 17, 2020. It is now read-only.

Commit

Permalink
WIP video text animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Trozeman committed Feb 13, 2020
1 parent c10a474 commit e16fff7
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 13 deletions.
65 changes: 55 additions & 10 deletions GGJ/Assets/Scenes/VideoScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ GameObject:
- component: {fileID: 1812171568}
- component: {fileID: 1812171570}
- component: {fileID: 1812171567}
- component: {fileID: 1812171572}
- component: {fileID: 1812171571}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
Expand All @@ -728,10 +730,10 @@ RectTransform:
m_Father: {fileID: 1159731776}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -418}
m_SizeDelta: {x: 1301.5, y: 157.3}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 78.649994}
m_SizeDelta: {x: -226.2, y: 157.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!95 &1812171567
Animator:
Expand Down Expand Up @@ -765,25 +767,25 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Color: {r: 1, g: 0.8160377, b: 0.94048285, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 54
m_FontStyle: 0
m_Font: {fileID: 12800000, guid: 6451d4b670625ef4db4f07f2b4e3e249, type: 3}
m_FontSize: 72
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 54
m_MaxSize: 72
m_Alignment: 1
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Shadow step
m_Text:
--- !u!222 &1812171569
CanvasRenderer:
m_ObjectHideFlags: 0
Expand All @@ -804,6 +806,49 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 970a64b0f72309144af5e8c5146b2258, type: 3}
m_Name:
m_EditorClassIdentifier:
texts:
- I, Jirrno Liovanna, have a dream
- That one day i'll become mangaku
- Byt my parents have other idea.
- They want me to become a doctor.
- Med school, internship, and the most
- punishing practice on the MEDSHIP
- in the GALAXY FAR, FAR AWAY.
- But someday i gonna fix my spaceship
- and get out of here...
- I just need some money!
outText: {fileID: 1812171568}
delay: 3
--- !u!114 &1812171571
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1812171565}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 1, g: 0, b: 0.53333336, a: 1}
m_EffectDistance: {x: -2, y: -2}
m_UseGraphicAlpha: 1
--- !u!114 &1812171572
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1812171565}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 1, g: 0, b: 0.53292704, a: 1}
m_EffectDistance: {x: 2, y: 2}
m_UseGraphicAlpha: 1
--- !u!1 &1895054951
GameObject:
m_ObjectHideFlags: 0
Expand Down
26 changes: 23 additions & 3 deletions GGJ/Assets/Scripts/Video/textAnimationController.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class textAnimationController : MonoBehaviour
{
private Animator anim;

int q = 0;
public string[] texts;
public Text outText;
public float delay;
private bool isShow = false;
void Start()
{
anim = gameObject.GetComponent<Animator>();
anim.Play("TextAnimation");
outText.text = texts[q];
InvokeRepeating("writeText", 1f, delay);
}

// Update is called once per frame

void writeText(){

if(q < texts.Length){
if(isShow){
anim.Play("fadeOutTextAnimation");
}else{
outText.text = texts[q];
anim.Play("TextAnimation");
q++;
}
isShow = !isShow;
}

}
void Update()
{
if (Input.GetKeyDown("space"))
Expand Down

0 comments on commit e16fff7

Please sign in to comment.