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을 사용하여 단계를 반전시켜 한 번 튕기도록 했습니다.
코드는 깃허브 에 있습니다.