untiy实现文本滚动
生活随笔
收集整理的這篇文章主要介紹了
untiy实现文本滚动
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
關鍵代碼(初學)
if (Isplayers){if (speed != 0 && anxia == false){//將文本框的自適應高度 賦值給 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);}//文本隨時間滾動播放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);}}總結
以上是生活随笔為你收集整理的untiy实现文本滚动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle sql中( ),Oracl
- 下一篇: 「CH2401」送礼物 解题报告