以下是支付宝小程序代码,先上效果图
以下是axml代码:
<view class="view">
<block a:for="{
{bulletChatData}}" a:key="id">
<text class="item" style="animation: first 8s linear forwards;top:{
{item.top}}%;color:{
{item.color}};">{
{
index+item.text}}</text>
</block>
</view>
js:
const app = getApp();
var bulletChatList = [];
var id = 0;
var cycle = null; //计时器
var topArray = [0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150];//用来做随机top值
var usedTop =