当前位置: 首页 > news >正文

在百度怎么做网站视频剪辑培训

在百度怎么做网站,视频剪辑培训,网站页面设计报价模板,怎么做子网站针对第一版的优化,自动适配文字大小,TextMeshPro可以拓展各种语言。第一版字母类语言效果更好。 using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI;public partial class TextBeat…

针对第一版的优化,自动适配文字大小,TextMeshPro可以拓展各种语言。第一版字母类语言效果更好。
第一版文字预制体优化

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;public partial class TextBeatCom
{List<RectTransform> m_showList = new List<RectTransform>();List<Animator> m_aniList = new List<Animator>();string m_text = string.Empty;int m_space = 50;float m_textSize = 1;public void Init(string text, int space = 50){if (string.IsNullOrEmpty(text)) return;m_text = text;m_space = space;m_textSize = 1;ResetContent();ShowText();}void ShowText(){CreateTextItem();StartCoroutine(PlayAnimation());}void CreateTextItem(){float last = 0, move = 0, textLength = 0;int length = m_text.Length;for (int index = 0; index < length; index++){var sChar = m_text[index].ToString();if (sChar != " ")//排除空格{float sx = 80;var obj = InstantiateChild(sChar, out sx);if (obj != null){textLength += sx;var rt = obj.GetComponent<RectTransform>();m_showList.Add(rt);}}else{textLength += m_space;m_showList.Add(null);}}m_textSize = (float)Screen.width / textLength;m_textSize = m_textSize > 1 ? 1 : m_textSize;for (int index = 0; index < m_showList.Count; index++){var rt = m_showList[index];if (rt != null)//排除空格{//设置字体尺寸和缩放Vector2 size = rt.sizeDelta;size.x *= m_textSize;rt.sizeDelta = size;rt.localScale = Vector3.one * m_textSize;//设置字体间距move += rt.rect.width / 2 + last / 2;rt.anchoredPosition = new Vector2(move, 0);last = rt.rect.width;m_aniList.Add(rt.GetComponent<Animator>());}else{move += m_space;//空格}}if (m_showList.Count > 0 && m_showList[0] != null) move += (int)m_showList[0].rect.width >> 1;move = (int)move >> 1;for (int index = 0; index < m_showList.Count; index++){var obj = m_showList[index];if (obj != null) {var pos = obj.anchoredPosition;pos.x -= move;obj.anchoredPosition = pos;}}}Transform InstantiateChild(string sChar, out float outSX){var child = m_xxx.transform;var childText = child.Find("Text");TextMeshProUGUI textMeshProUGUI = childText.GetComponent<TextMeshProUGUI>();textMeshProUGUI.text = sChar;childText = childText.Find("Text");textMeshProUGUI = childText.GetComponent<TextMeshProUGUI>();textMeshProUGUI.text = sChar;var rt = child.GetComponent<RectTransform>();rt.SetActive(true);Vector2 size = rt.sizeDelta;float sx = size.x;TMP_Text m_TextComponent = textMeshProUGUI.GetComponent<TMP_Text>();m_TextComponent.havePropertiesChanged = true;m_TextComponent.ForceMeshUpdate();TMP_TextInfo textInfo = m_TextComponent.textInfo;int characterCount = textInfo.characterInfo.Length;if (characterCount > 0){//sx = textInfo.characterInfo[0].ascender * textInfo.characterInfo[0].aspectRatio - textInfo.characterInfo[0].baseLine;sx = textInfo.characterInfo[0].bottomRight.x - textInfo.characterInfo[0].bottomLeft.x;}size.x = sx;rt.sizeDelta = size;rt.SetActive(false);outSX = size.x * 1.3f;return GameObject.Instantiate(child, m_scroll.content.transform);}IEnumerator PlayAnimation(){yield return PlayShow();PlayBeat();}IEnumerator PlayShow(){int playFinishNum = 0;for (int i = 0; i < m_aniList.Count; i++){var obj = m_aniList[i];obj.SetActive(true);obj.OnPlay("Show").OnComplete(() => { playFinishNum++; });yield return new WaitForSecondsRealtime(0.05f);}yield return new WaitUntil(() => playFinishNum >= m_aniList.Count);}void PlayBeat(){for (int index = 0; index < m_aniList.Count; index++){var obj = m_aniList[index];obj.Play("Beat");}}void ResetContent(){for (int index = 0; index < m_scroll.content.childCount; index++){m_scroll.content.GetChild(index).SetActive(false);}}public void OnClear(){for (int index = 0; index < m_showList.Count; index++){var tran = m_showList[index];m_showList.Remove(tran);index--;if(tran != null) GameObject.Destroy(tran.gameObject);}m_showList.Clear();m_aniList.Clear();}
}
http://www.dinnco.com/news/5901.html

相关文章:

  • pc网站是什么免费seo免费培训
  • 东莞建网页东莞seo建站咨询
  • 一流的盐城网站建设重庆网站排名提升
  • 菏泽网站建设电话seo引擎优化
  • fn网站不是做那么好吗磁力宝最佳搜索引擎入口
  • 如何做网站导航栏的搜索引擎优化北京知名seo公司精准互联
  • 青岛网站建设市场广东新闻今日最新闻
  • 基于web网站开发app优化
  • 用户登录网站开发整合营销包括哪三方面
  • 手机网站建设推荐乐云seo网络软文发布
  • 青岛做个网站多少钱seo搜索引擎优化是什么
  • 富阳公司做网站seo优化方式包括
  • 怀柔做网站的公司新乡网络推广外包
  • 班级网站怎么做搜外滴滴友链
  • 南京网站建设cnee刷粉网站推广马上刷
  • 通灵人预言2023年疫情优化seo方法
  • 保定网站制作推广公司百度关键词
  • 深圳电商平台网站建设一起来看在线观看免费
  • 1个g网站空间多少钱中国职业培训在线官方网站
  • 国内最好的在线网站建设河南公司网站建设
  • 网站规划小结seo案例分析
  • 江西网站建设公司电话手机百度下载免费安装
  • 个人网站如何做淘宝客成都网站建设技术支持
  • 零食网站色调搭配怎麽做微信seo是什么意思
  • 网站建设公司软件开发小红书代运营
  • 有孩子做的网站高级搜索技巧
  • 网站策划书背景介绍网站产品推广
  • web网站如何做性能测试建一个网站需要多少钱?
  • 网站建设需要用软件seo研究协会网app
  • dz论坛可以做商业网站大数据精准营销