当前位置:网站首页>unity 字幕滚动
unity 字幕滚动
2022-07-17 20:03:00 【云小川】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextSpeed : MonoBehaviour
{
private float speed = 100;
public RectTransform maskRec;//text 父物体
public RectTransform rec;//text
float localX;
float localY;
float localZ;
float txtWidth;
// Start is called before the first frame update
void Start()
{
localY = transform.localPosition.y;
localZ = transform.localPosition.z;
//Debug.LogError(maskRec.rect.width);
if (maskRec!=null)
rec.anchoredPosition = new Vector2(maskRec.rect.width, 0);
}
// Update is called once per frame
void Update()
{
if (speed != 0)
{
if (rec != null)
txtWidth = rec.rect.width;
if (rec.anchoredPosition.x < -txtWidth)
{
rec.anchoredPosition = new Vector2(maskRec.rect.width, 0);
}
localX = transform.localPosition.x - speed * Time.deltaTime;
transform.localPosition = new Vector3(localX, localY, localZ);
}
}
}边栏推荐
- ModuleNotFoundError: No module named ‘_distutils_hack‘
- [code hoof set novice village question 600] format specifier of float and double
- Microservice calling component feign practice
- CBS类型PVC回收策略
- No.2 compilation preliminary
- How to earn money in low-level cities
- [code shoe set novice village question 600] for the formatting control of strings, that is, the width and accuracy of strings
- 【考研词汇训练营】Day 5 —— alarmist,cooperate,point,benefit,industrial,revolution,mechanize
- [机缘参悟-46]:鬼谷子-第十谋篇-谋者,智慧之意也
- ModuleNotFoundError: No module named ‘_ distutils_ hack‘
猜你喜欢

Onvif protocol related: 3.1.3 get screenshot URL in digest mode

asterisk: rejected because extension not found in context ‘from-ipphone‘
![[code hoof set novice village question 600] operator / type conversion in different operation sequences](/img/a0/ba793491f4b1ad1c7545968b61723e.png)
[code hoof set novice village question 600] operator / type conversion in different operation sequences

Use of Google browser developer tools (Master!)

Uniapp Gaode map positioning function

统计直播间的榜一信息,从这里起步

关于数据字典的一些解惑

Design and Simulation of anti reverse connection circuit based on MOS transistor

「津津乐道播客」#392 原汤话原食:仲夏夜,马砂、肉串儿、趿拉板儿

Tencent cloud object storage operation process
随机推荐
深度学习从入门到放弃100天挑战
ImportError: DLL load failed while importing win32api: 找不到指定的程序。
asterisk:No compatible codecs, not accepting this offer!
【码蹄集新手村 600 题】科学计数法的实现方式,输出指数形式
这些年我开源的几个小项目
Tke (k8s) deploy MySQL using CFS storage
Onvif protocol related: 4.1.2 WS username token method to obtain token
毕设-基于SSM在线预约挂号系统
No.4 bits, bytes, information storage
AcWing第 60 场周赛
【码蹄集新手村 600 题】float 与 double 的格式说明符
No.3汇编进阶
Use of Google browser developer tools (Master!)
Start from here by counting the information of the broadcast room
鸿蒙设备开发快速入门之Helloword与LED——华为云14天鸿蒙设备开发实战学习笔记 第二篇
TKE跨云联网挂载CFS
【ACWing】2492. HH Necklace
Android开发大厂面试,做好这3个准备,规划好自己
分析并HOOK SSHD来劫持密码
无声的AI:昇腾AI如何用大模型破解手语学习的难题?