넌 (CORS이 예에서 문제되지 않음을 의미한다)의 화소를 반복하지 않고 이것을 달성하는 복합 모드 및 클리핑의 조합을 사용할 수
Fiddle
![Waveform progress](https://i.stack.imgur.com/ZVsJj.png)
필수 코드 :
가정하면 이미지가로드 된, 우리가 좋은 캔버스 설정이 이동 :
function loop() {
x++; // sync this with actual progress
// since we will change composite mode and clip:
ctx.save();
// clear background with black
ctx.fillStyle = '#000';
ctx.fillRect(0, 0, w, h);
// remove waveform, change composite mode
ctx.globalCompositeOperation = 'destination-atop';
ctx.drawImage(img, 0, 0, w, h);
// fill new alpha, same mode, different region.
// as this will remove anything else we need to clip it
ctx.fillStyle = '#00a'; /// gradient
ctx.rect(0, 0, x, h);
ctx.clip(); /// set clipping rect
ctx.fill(); /// use the same rect to fill
// remove clip and use default composite mode
ctx.restore();
// loop until end
if (x < w) requestAnimationFrame(start);
}
는 "재생하지 않은"파형이 다른 색 단순히 background
와 캔버스 요소의 스타일을 갖고 싶어.
출처
2013-10-23 23:23:49
K3N
안녕하세요,이 트릭을 할 것 같아요하지만 단 하나의 문제가 있습니다. 진행률 막대는 '
'과 같은 div이고 너비는 노래의 진행과 함께 점차 증가합니다. 이런 식으로 진행 바를 할 수있는 방법이 있습니까? 당신이 나의 위치를 볼 필요가있는 경우에 나는 당신에게 URL를 보낼 수있다. –