I JD H JD G BK F BK E JD D WT C BK B BK A JD /* ステッチカラー箱 */ ステッチ JD // すべてのpath要素を取得 const paths = document.querySelectorAll('path'); // 各path要素のd属性を変更して、y座標を100上げる paths.forEach(path => { let d = path.getAttribute('d'); d = d.replace(/([MLCSTV])(-?\d*\.?\d+),(-?\d*\.?\d+)/g, (match, command, x, y) => { return `${command}${x},${parseFloat(y) + 100}`; }); path.setAttribute('d', d); // 新しいd属性を設定 });