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」送礼物 解题报告