使用 JSL 製作的影片。
專為 1920x1080 顯示器設計。
JSL 使用資料表來保存影片中每個移動點的一行資料。
ForEachRow 迴圈使用列名變數 rowpos 和 colpos 將點放置在點陣圖矩陣的行和列中,並使用 rowstep 和 colstep 來推進每一幀的 rowpos 和 colpos。
dt = New Table( "points", "private", // private is *much* faster
Add Rows( npoints ), // this table has a row per moving point, location, vector, color
New Column( "rowpos" ), New Column( "colpos" ), New Column( "rowstep" ), New Column( "colstep" ),
New Column( "bounce" ), New Column( "rpix" ), New Column( "gpix" ), New Column( "bpix" )
);
將分數推進到下一幀:
movepoints = Function( {}, // on each frame the points are all advanced and checked for leaving the bitmap
For Each Row( dt,
If( 1 <= (dt:rowpos + dt:rowstep) < nr + 1, // hit bottom or top edge?
0 // not leaving
, // else...hit the edge
dt:bounce += 1;
If( dt:bounce > bounceLimit,
reset( Row() ) // restart
, // else keep bouncing
dt:rowstep = -dt:rowstep // if bouncing, reverse
);
);
If( 1 <= (dt:colpos + dt:colstep) < nc + 1, // hit left or right edge?
0 // not leaving
, // else...hit the edge
dt:bounce += 1;
If( dt:bounce > bounceLimit,
reset( Row() ) // restart
, // else keep bouncing
dt:colstep = -dt:colstep // reverse
);
);
dt:rowpos += dt:rowstep; // move this point along its path
dt:colpos += dt:colstep;
)
);
複雜的 if 語句用於測試點是否即將離開幀;早期版本使用 bounceLimit=1 來允許它們反彈一次,方法是反轉步驟。
程式碼已上傳至GitHub 。