untiy实现文本滚动
生活随笔
收集整理的這篇文章主要介紹了
untiy实现文本滚动
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
關(guān)鍵代碼(初學(xué))
if (Isplayers){if (speed != 0 && anxia == false){//將文本框的自適應(yīng)高度 賦值給 txtheighttxtheight = rec.rect.height;//播放完畢,則初始化文本位置 if (rec.anchoredPosition.y > txtheight / 2 + maskRec.rect.height / 2){rec.anchoredPosition = new Vector2(0, -rec.rect.height / 2 - maskRec.rect.height / 2);}//文本隨時(shí)間滾動(dòng)播放localY = transform.localPosition.y + speed * Time.deltaTime;transform.localPosition = new Vector3(localX, localY, localZ);if (rec.anchoredPosition.y < -(rec.rect.height / 2 + (maskRec.rect.height / 2))){rec.anchoredPosition = new Vector2(0, -rec.rect.height / 2 - maskRec.rect.height / 2);}}總結(jié)
以上是生活随笔為你收集整理的untiy实现文本滚动的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: oracle sql中( ),Oracl
- 下一篇: Python菜鸟爬虫技巧