JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id=c width="211" height="1000"></canvas>
JavaScript
let ctx = c.getContext("2d");
let p=(offset, width, t)=>offset+Math.sin(t/width)*width;
let p2=(offset, width, t)=>offset+(t%width*2);
ctx.fillStyle='#f00';
for (let y=0;y<c.height;y++) {
ctx.fillRect(p(30,20,y),y,1,1);
ctx.fillRect(p2(30,20,y),y,1,1);
}