{"id":9036,"date":"2025-09-17T13:24:23","date_gmt":"2025-09-17T04:24:23","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?page_id=9036"},"modified":"2025-09-17T13:24:23","modified_gmt":"2025-09-17T04:24:23","slug":"svg2gif-converter","status":"publish","type":"page","link":"https:\/\/code-plus.jp\/gp\/tools\/svg2gif-converter\/","title":{"rendered":"SVG\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u2192GIF\u5909\u63db\u30c4\u30fc\u30eb"},"content":{"rendered":"<style>\n  * {\n  margin: 0;\n  padding: 0;\n  box-sizing: border-box;\n  }\n  \n  body {\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;\n  background: #f5f5f5;\n  min-height: 100vh;\n  padding: 20px;\n  }\n  \n  .container {\n  max-width: 1200px;\n  margin: 0 auto;\n  background: white;\n  border-radius: 12px;\n  box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n  overflow: hidden;\n  }\n  \n  .header {\n  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n  color: white;\n  padding: 30px;\n  text-align: center;\n  }\n  \n  .header h1 {\n  font-size: 2em;\n  margin-bottom: 10px;\n  }\n  \n  .header p {\n  opacity: 0.9;\n  font-size: 1.1em;\n  }\n  \n  .content {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 30px;\n  padding: 40px;\n  }\n  \n  @media (max-width: 768px) {\n  .content {\n  grid-template-columns: 1fr;\n  }\n  }\n  \n  .column {\n  display: flex;\n  flex-direction: column;\n  }\n  \n  .column h3 {\n  color: #333;\n  margin-bottom: 20px;\n  font-size: 1.3em;\n  }\n  \n  .endropArea {\n  border: 3px dashed #ccc;\n  border-radius: 15px;\n  padding: 40px;\n  text-align: center;\n  cursor: pointer;\n  transition: all 0.3s;\n  background: #fafafa;\n  min-height: 350px;\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n  align-items: center;\n  }\n  \n  .endropArea:hover {\n  border-color: #667eea;\n  background: #f0f0ff;\n  }\n  \n  .endropArea.dragover {\n  background: #e8e8ff;\n  border-color: #764ba2;\n  }\n  \n  .endropArea.has-file {\n  border-color: var(--c-success, hsl(123, 46%, 35%));\n  background: #f1f8f4;\n  }\n  \n  .endrop-icon {\n  font-size: 48px;\n  margin-bottom: 20px;\n  }\n  \n  .endrop-text {\n  font-size: 1.2em;\n  color: #666;\n  margin-bottom: 10px;\n  }\n  \n  .drop-subtext {\n  font-size: 0.9em;\n  color: #999;\n  }\n  \n  .file-input {\n  display: none;\n  }\n  \n  .preview-area {\n  border: 2px solid #e0e0e0;\n  border-radius: 15px;\n  padding: 20px;\n  background: #fafafa;\n  min-height: 350px;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  }\n  \n  .preview-area canvas {\n  max-width: 100%;\n  border-radius: 8px;\n  box-shadow: 0 2px 8px rgba(0,0,0,0.1);\n  }\n  \n  .preview-placeholder {\n  color: #999;\n  font-size: 1.1em;\n  text-align: center;\n  }\n  \n  .controls {\n  margin-top: 20px;\n  padding: 20px;\n  background: #f9f9f9;\n  border-radius: 10px;\n  }\n  \n  .control-group {\n  margin-bottom: 20px;\n  }\n  \n  .control-group label {\n  display: block;\n  color: #555;\n  margin-bottom: 8px;\n  font-weight: 500;\n  }\n  \n  .control-group input[type=\"range\"] {\n  width: 100%;\n  margin-bottom: 5px;\n  }\n  \n  .control-value {\n  color: #667eea;\n  font-weight: bold;\n  float: right;\n  }\n  \n  .button {\n  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n  color: white;\n  border: none;\n  padding: 12px 30px;\n  border-radius: 25px;\n  font-size: 1.1em;\n  cursor: pointer;\n  transition: all 0.3s;\n  margin-top: 20px;\n  width: 100%;\n  box-shadow: 0 4px 15px 0 rgba(102, 126, 234, 0.4);\n  }\n  \n  .button:hover {\n  transform: translateY(-2px);\n  box-shadow: 0 6px 20px 0 rgba(102, 126, 234, 0.5);\n  }\n  \n  .button:disabled {\n  background: linear-gradient(135deg, #ccc 0%, #999 100%);\n  cursor: not-allowed;\n  box-shadow: none;\n  }\n  \n  .button:disabled:hover {\n  transform: none;\n  }\n  \n  .download-button {\n  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);\n  display: none;\n  box-shadow: 0 4px 15px 0 rgba(86, 171, 47, 0.4);\n  }\n  \n  .download-button:hover {\n  box-shadow: 0 6px 20px 0 rgba(86, 171, 47, 0.5);\n  }\n  \n  .download-button.show {\n  display: block;\n  }\n  \n  .status-message {\n  padding: 15px;\n  border-radius: 8px;\n  margin-top: 20px;\n  text-align: center;\n  display: none;\n  font-weight: 500;\n  }\n  \n  .status-message.success {\n  background: #d4edda;\n  color: #155724;\n  border: 1px solid #c3e6cb;\n  display: block;\n  }\n  \n  .status-message.error {\n  background: #f8d7da;\n  color: #721c24;\n  border: 1px solid #f5c6cb;\n  display: block;\n  }\n  \n  .status-message.processing {\n  background: #cce5ff;\n  color: #004085;\n  border: 1px solid #b8daff;\n  display: block;\n  }\n  \n  .progress-wrapper {\n  margin-top: 20px;\n  display: none;\n  }\n  \n  .progress-wrapper.show {\n  display: block;\n  }\n  \n  .progress-bar {\n  width: 100%;\n  height: 30px;\n  background: #e9ecef;\n  border-radius: 15px;\n  overflow: hidden;\n  }\n  \n  .progress-fill {\n  height: 100%;\n  background: linear-gradient(90deg, #667eea, #764ba2);\n  transition: width 0.3s;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: white;\n  font-size: 0.9em;\n  font-weight: bold;\n  }\n  \n  .info-box {\n  background: #f0f4ff;\n  border-left: 4px solid #667eea;\n  padding: 20px;\n  margin: 20px 0;\n  border-radius: 8px;\n  }\n  \n  .info-box h4 {\n  color: #764ba2;\n  margin-bottom: 12px;\n  }\n  \n  .info-box ul {\n  list-style: none;\n  padding-left: 0;\n  }\n  \n  .info-box li {\n  padding: 8px 0;\n  color: #555;\n  line-height: 1.6;\n  }\n  \n  .info-box li::before {\n  content: \"\u2713 \";\n  color: #667eea;\n  font-weight: bold;\n  margin-right: 8px;\n  }\n  \n  .svg-display {\n  max-width: 100%;\n  max-height: 300px;\n  margin: 20px 0;\n  padding: 20px;\n  background: white;\n  border-radius: 8px;\n  border: 1px solid #e0e0e0;\n  }\n  \n  .svg-display svg {\n  max-width: 100%;\n  height: auto;\n  }\n  \n  .file-info {\n  background: #f9f9f9;\n  padding: 15px;\n  border-radius: 8px;\n  margin-top: 15px;\n  font-size: 0.9em;\n  color: #666;\n  }\n  \n  .file-info strong {\n  color: #333;\n  }\n  <\/style>\n  \n  <div class=\"container\">\n    <div class=\"header\">\n      <h1>SVG\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u2192GIF\u5909\u63db\u30c4\u30fc\u30eb<\/h1>\n      <p>SVG\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306bGIF\u753b\u50cf\u306b\u5909\u63db<\/p>\n    <\/div>\n  \n    <div class=\"content\">\n      <div class=\"column\">\n        <h3>\u25bc SVG\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30ed\u30c3\u30d7\u3057\u3066\u304f\u3060\u3055\u3044<\/h3>\n        <div id=\"endropArea\" class=\"endrop-area\">\n          <div class=\"endrop-icon\">\ud83d\udcc1<\/div>\n          <div class=\"endrop-text\">SVG\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30e9\u30c3\u30b0&\u30c9\u30ed\u30c3\u30d7<\/div>\n          <div class=\"drop-subtext\">\u307e\u305f\u306f \u30af\u30ea\u30c3\u30af\u3057\u3066\u9078\u629e<\/div>\n          <input type=\"file\" id=\"fileInput\" class=\"file-input\" accept=\".svg,image\/svg+xml\">\n        <\/div>\n  \n        <div id=\"svgInfo\" class=\"file-info\" style=\"display: none;\">\n          <strong>\u30d5\u30a1\u30a4\u30eb\u540d:<\/strong> <span id=\"fileName\"><\/span><br>\n          <strong>\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba:<\/strong> <span id=\"fileSize\"><\/span>\n        <\/div>\n  \n        <div class=\"controls\">\n          <div class=\"control-group\">\n            <label for=\"frameCount\">\n              \u30d5\u30ec\u30fc\u30e0\u6570:\n              <span class=\"control-value\" id=\"frameCountValue\">20<\/span>\n            <\/label>\n            <input type=\"range\" id=\"frameCount\" min=\"10\" max=\"60\" value=\"20\">\n          <\/div>\n  \n          <div class=\"control-group\">\n            <label for=\"duration\">\n              \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u6642\u9593 (\u79d2):\n              <span class=\"control-value\" id=\"durationValue\">3<\/span>\n            <\/label>\n            <input type=\"range\" id=\"duration\" min=\"1\" max=\"10\" value=\"3\" step=\"0.5\">\n          <\/div>\n  \n          <div class=\"control-group\">\n            <label for=\"scale\">\n              \u30b9\u30b1\u30fc\u30eb (%):\n              <span class=\"control-value\" id=\"scaleValue\">100<\/span>\n            <\/label>\n            <input type=\"range\" id=\"scale\" min=\"25\" max=\"200\" value=\"100\" step=\"25\">\n          <\/div>\n  \n          <button class=\"button\" id=\"convertButton\" disabled>\u5909\u63db\u958b\u59cb \u00bb<\/button>\n        <\/div>\n  \n        <div class=\"progress-wrapper\" id=\"progressWrapper\">\n          <div class=\"progress-bar\">\n            <div class=\"progress-fill\" id=\"progressFill\">0%<\/div>\n          <\/div>\n        <\/div>\n  \n        <div class=\"status-message\" id=\"statusMessage\"><\/div>\n      <\/div>\n  \n      <div class=\"column\">\n        <h3>\u25bc \u5909\u63db\u5f8c\u306eGIF\u753b\u50cf<\/h3>\n        <div class=\"preview-area\" id=\"previewArea\">\n          <div class=\"preview-placeholder\">\n            \u5909\u63db\u3055\u308c\u305fGIF\u304c\u3053\u3053\u306b\u8868\u793a\u3055\u308c\u307e\u3059\n          <\/div>\n        <\/div>\n  \n        <button class=\"button download-button\" id=\"downloadButton\">\n          \ud83d\udcbe GIF\u753b\u50cf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\n        <\/button>\n  \n        <div class=\"info-box\">\n          <h4>\ud83d\udca1 \u4f7f\u3044\u65b9\u306e\u30d2\u30f3\u30c8<\/h4>\n          <ul>\n            <li>SVG\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30ed\u30c3\u30d7\u30a8\u30ea\u30a2\u306b\u30c9\u30e9\u30c3\u30b0<\/li>\n            <li>\u30d5\u30ec\u30fc\u30e0\u6570\uff1a\u591a\u3044\u307b\u3069\u6ed1\u3089\u304b\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u5897\u52a0\u3057\u307e\u3059<\/li>\n            <li>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u6642\u9593\uff1aGIF\u306e\u518d\u751f\u6642\u9593\u3092\u8abf\u6574\u3067\u304d\u307e\u3059<\/li>\n            <li>\u30b9\u30b1\u30fc\u30eb\uff1a\u51fa\u529b\u30b5\u30a4\u30ba\u3092\u8abf\u6574\u3067\u304d\u307e\u3059<\/li>\n            <li>\u5bfe\u5fdc\u5f62\u5f0f\uff1aCSS\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3001SMIL\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3<\/li>\n          <\/ul>\n        <\/div>\n      <\/div>\n    <\/div>\n  <\/div>\n  \n  <script>\n    \/\/\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\n    let svgContent = null;\n    let svgFileName = '';\n    let frames = [];\n  \n    \/\/DOM\u8981\u7d20\n    const endropArea = document.getElementById('endropArea');\n    const fileInput = document.getElementById('fileInput');\n    const convertButton = document.getElementById('convertButton');\n    const downloadButton = document.getElementById('downloadButton');\n    const statusMessage = document.getElementById('statusMessage');\n    const progressWrapper = document.getElementById('progressWrapper');\n    const progressFill = document.getElementById('progressFill');\n    const previewArea = document.getElementById('previewArea');\n    const svgInfo = document.getElementById('svgInfo');\n    const fileName = document.getElementById('fileName');\n    const fileSize = document.getElementById('fileSize');\n  \n    \/\/\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u8981\u7d20\n    const frameCountSlider = document.getElementById('frameCount');\n    const durationSlider = document.getElementById('duration');\n    const scaleSlider = document.getElementById('scale');\n  \n    \/\/\u30b9\u30e9\u30a4\u30c0\u30fc\u306e\u5024\u8868\u793a\u66f4\u65b0\n    frameCountSlider.addEventListener('input', (e) => {\n      document.getElementById('frameCountValue').textContent = e.target.value;\n    });\n  \n    durationSlider.addEventListener('input', (e) => {\n      document.getElementById('durationValue').textContent = e.target.value;\n    });\n  \n    scaleSlider.addEventListener('input', (e) => {\n      document.getElementById('scaleValue').textContent = e.target.value;\n    });\n  \n    \/\/\u30c9\u30e9\u30c3\u30b0&\u30c9\u30ed\u30c3\u30d7\u30a4\u30d9\u30f3\u30c8\n    endropArea.addEventListener('click', () => fileInput.click());\n  \n    endropArea.addEventListener('dragover', (e) => {\n      e.preventDefault();\n      endropArea.classList.add('dragover');\n    });\n  \n    endropArea.addEventListener('dragleave', () => {\n      endropArea.classList.remove('dragover');\n    });\n  \n    endropArea.addEventListener('drop', (e) => {\n      e.preventDefault();\n      endropArea.classList.remove('dragover');\n      const file = e.dataTransfer.files[0];\n      if (file) handleFile(file);\n    });\n  \n    fileInput.addEventListener('change', (e) => {\n      const file = e.target.files[0];\n      if (file) handleFile(file);\n    });\n  \n    \/\/\u30d5\u30a1\u30a4\u30eb\u51e6\u7406\n    function handleFile(file) {\n      if (!file || !file.type.includes('svg')) {\n        showStatus('SVG\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044', 'error');\n        return;\n      }\n  \n      svgFileName = file.name.replace('.svg', '');\n      fileName.textContent = file.name;\n      fileSize.textContent = formatFileSize(file.size);\n      svgInfo.style.display = 'block';\n  \n      const reader = new FileReader();\n      reader.onload = (e) => {\n        svgContent = e.target.result;\n        endropArea.classList.add('has-file');\n        endropArea.innerHTML = `\n  <div class=\"svg-display\">${svgContent}<\/div>\n  <div class=\"drop-subtext\">\u65b0\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30ed\u30c3\u30d7\u3057\u3066\u5909\u66f4<\/div>\n  `;\n        convertButton.disabled = false;\n        showStatus('SVG\u30d5\u30a1\u30a4\u30eb\u304c\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3057\u305f', 'success');\n      };\n      reader.readAsText(file);\n    }\n  \n    \/\/\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\n    function formatFileSize(bytes) {\n      if (bytes < 1024) return bytes + ' B';\n      if (bytes < 1048576) return Math.round(bytes \/ 1024) + ' KB';\n      return Math.round(bytes \/ 1048576 * 10) \/ 10 + ' MB';\n    }\n  \n    \/\/\u5909\u63db\u30dc\u30bf\u30f3\u30af\u30ea\u30c3\u30af\n    convertButton.addEventListener('click', async () => {\n      if (!svgContent) return;\n  \n      convertButton.disabled = true;\n      showStatus('\u5909\u63db\u51e6\u7406\u4e2d...\u3057\u3070\u3089\u304f\u304a\u5f85\u3061\u304f\u3060\u3055\u3044', 'processing');\n      progressWrapper.classList.add('show');\n      downloadButton.classList.remove('show');\n      frames = [];\n  \n      try {\n        await convertSvgToFrames();\n        showStatus('\u5909\u63db\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\uff01', 'success');\n      } catch (error) {\n        showStatus('\u5909\u63db\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: ' + error.message, 'error');\n        console.error(error);\n      } finally {\n        convertButton.disabled = false;\n        progressWrapper.classList.remove('show');\n      }\n    });\n  \n    \/\/SVG\u3092\u30d5\u30ec\u30fc\u30e0\u306b\u5909\u63db\n    async function convertSvgToFrames() {\n      const frameCount = parseInt(frameCountSlider.value);\n      const duration = parseFloat(durationSlider.value);\n      const scale = parseInt(scaleSlider.value) \/ 100;\n  \n      \/\/SVG\u306e\u30b5\u30a4\u30ba\u3092\u53d6\u5f97\n      const parser = new DOMParser();\n      const doc = parser.parseFromString(svgContent, 'image\/svg+xml');\n      const svgElement = doc.querySelector('svg');\n  \n      let width = 500;\n      let height = 500;\n  \n      if (svgElement) {\n        const viewBox = svgElement.getAttribute('viewBox');\n        if (viewBox) {\n          const parts = viewBox.split(' ');\n          width = parseFloat(parts[2]) * scale;\n          height = parseFloat(parts[3]) * scale;\n        } else {\n          width = (parseFloat(svgElement.getAttribute('width')) || 500) * scale;\n          height = (parseFloat(svgElement.getAttribute('height')) || 500) * scale;\n        }\n      }\n  \n      \/\/\u30ad\u30e3\u30f3\u30d0\u30b9\u4f5c\u6210\n      const canvas = document.createElement('canvas');\n      canvas.width = width;\n      canvas.height = height;\n      const ctx = canvas.getContext('2d');\n  \n      \/\/\u5404\u30d5\u30ec\u30fc\u30e0\u3092\u751f\u6210\n      for (let i = 0; i < frameCount; i++) {\n        const progress = i \/ (frameCount - 1);\n        updateProgress(Math.round(progress * 100));\n  \n        \/\/SVG\u3092\u6642\u9593\u8ef8\u4e0a\u3067\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\n        const frameData = await renderSvgFrame(svgContent, progress, canvas, ctx, width, height);\n        frames.push(frameData);\n  \n        await delay(50); \/\/\u51e6\u7406\u3092\u5206\u6563\n      }\n  \n      \/\/\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\uff08\u6700\u521d\u306e\u30d5\u30ec\u30fc\u30e0\uff09\n      if (frames.length > 0) {\n        displayPreview(frames, duration, width, height);\n        setupDownload(frames, duration, width, height);\n      }\n    }\n  \n    \/\/SVG\u30d5\u30ec\u30fc\u30e0\u3092\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\n    async function renderSvgFrame(svg, progress, canvas, ctx, width, height) {\n      return new Promise((resolve, reject) => {\n        \/\/SVG\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u6642\u9593\u3092\u8abf\u6574\n        const modifiedSvg = updateSvgForProgress(svg, progress);\n  \n        const img = new Image();\n        const blob = new Blob([modifiedSvg], { type: 'image\/svg+xml' });\n        const url = URL.createObjectURL(blob);\n  \n        img.onload = () => {\n          ctx.clearRect(0, 0, width, height);\n          ctx.fillStyle = 'white';\n          ctx.fillRect(0, 0, width, height);\n          ctx.drawImage(img, 0, 0, width, height);\n  \n          const imageData = canvas.toDataURL('image\/png');\n          URL.revokeObjectURL(url);\n          resolve(imageData);\n        };\n  \n        img.onerror = () => {\n          URL.revokeObjectURL(url);\n          reject(new Error('\u30d5\u30ec\u30fc\u30e0\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f'));\n        };\n  \n        img.src = url;\n      });\n    }\n  \n    \/\/SVG\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u9032\u884c\u72b6\u614b\u3092\u66f4\u65b0\n    function updateSvgForProgress(svg, progress) {\n      const parser = new DOMParser();\n      const doc = parser.parseFromString(svg, 'image\/svg+xml');\n  \n      \/\/CSS\u5909\u6570\u3092\u4f7f\u7528\u3057\u305f\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u5236\u5fa1\n      const svgElement = doc.querySelector('svg');\n      if (svgElement) {\n        svgElement.style.setProperty('--progress', progress);\n        svgElement.style.setProperty('--frame', progress);\n  \n        \/\/\u30b9\u30bf\u30a4\u30eb\u30bf\u30b0\u3092\u8ffd\u52a0\u3057\u3066\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u5236\u5fa1\n        const styleElement = doc.createElement('style');\n        styleElement.textContent = `\n  * {\n  animation-delay: -${progress * 10}s !important;\n  animation-play-state: paused !important;\n  }\n  `;\n        svgElement.appendChild(styleElement);\n      }\n  \n      \/\/SMIL\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u6642\u9593\u3092\u8a2d\u5b9a\n      const animateElements = doc.querySelectorAll('animate, animateTransform, animateMotion, set');\n      animateElements.forEach(element => {\n        const dur = element.getAttribute('dur') || '1s';\n        const durValue = parseDuration(dur);\n        const time = durValue * progress;\n        element.setAttribute('begin', `-${time}s`);\n        element.setAttribute('fill', 'freeze');\n      });\n  \n      return new XMLSerializer().serializeToString(doc);\n    }\n  \n    \/\/\u6642\u9593\u306e\u30d1\u30fc\u30b9\n    function parseDuration(dur) {\n      if (dur.endsWith('s')) {\n        return parseFloat(dur);\n      } else if (dur.endsWith('ms')) {\n        return parseFloat(dur) \/ 1000;\n      }\n      return parseFloat(dur);\n    }\n  \n    \/\/\u30d7\u30ec\u30d3\u30e5\u30fc\u8868\u793a\uff08\u7c21\u6613\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\uff09\n    function displayPreview(frames, duration, width, height) {\n      const canvas = document.createElement('canvas');\n      canvas.width = width;\n      canvas.height = height;\n      const ctx = canvas.getContext('2d');\n  \n      let currentFrame = 0;\n      const frameDelay = (duration * 1000) \/ frames.length;\n  \n      const animate = () => {\n        const img = new Image();\n        img.onload = () => {\n          ctx.clearRect(0, 0, width, height);\n          ctx.drawImage(img, 0, 0);\n        };\n        img.src = frames[currentFrame];\n  \n        currentFrame = (currentFrame + 1) % frames.length;\n      };\n  \n      setInterval(animate, frameDelay);\n  \n      previewArea.innerHTML = '';\n      previewArea.appendChild(canvas);\n    }\n  \n    \/\/\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u8a2d\u5b9a\n    function setupDownload(frames, duration, width, height) {\n      downloadButton.classList.add('show');\n      downloadButton.onclick = () => {\n        showStatus('GIF\u751f\u6210\u4e2d...\u3053\u306e\u51e6\u7406\u306b\u306f\u6642\u9593\u304c\u304b\u304b\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059', 'processing');\n  \n        \/\/\u30d5\u30ec\u30fc\u30e0\u30c7\u30fc\u30bf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u7528\u306b\u5909\u63db\n        \/\/\u6ce8\u610f: \u5b9f\u969b\u306eGIF\u751f\u6210\u306b\u306f\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u51e6\u7406\u304c\u5fc5\u8981\u3067\u3059\n        \/\/\u3053\u3053\u3067\u306f\u30d5\u30ec\u30fc\u30e0\u753b\u50cf\u306eZIP\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3092\u63d0\u4f9b\n        downloadFramesAsZip(frames);\n      };\n    }\n  \n    \/\/\u30d5\u30ec\u30fc\u30e0\u3092ZIP\u3068\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\uff08\u4ee3\u66ff\u6848\uff09\n    function downloadFramesAsZip(frames) {\n      \/\/\u7c21\u6613\u7684\u306a\u5b9f\u88c5\uff1a\u6700\u521d\u306e\u30d5\u30ec\u30fc\u30e0\u3092PNG\u3068\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\n      const link = document.createElement('a');\n      link.download = `${svgFileName}_frame.png`;\n      link.href = frames[0];\n      link.click();\n  \n      showStatus(`\u30d5\u30ec\u30fc\u30e0\u753b\u50cf\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3057\u305f\u3002\u5b8c\u5168\u306aGIF\u5909\u63db\u306b\u306f\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u51e6\u7406\u304c\u5fc5\u8981\u3067\u3059\u3002`, 'success');\n    }\n  \n    \/\/\u9032\u6357\u66f4\u65b0\n    function updateProgress(percent) {\n      progressFill.style.width = percent + '%';\n      progressFill.textContent = percent + '%';\n    }\n  \n    \/\/\u30b9\u30c6\u30fc\u30bf\u30b9\u8868\u793a\n    function showStatus(message, type) {\n      statusMessage.className = 'status-message ' + type;\n      statusMessage.textContent = message;\n  \n      if (type !== 'processing') {\n        setTimeout(() => {\n          statusMessage.className = 'status-message';\n        }, 5000);\n      }\n    }\n  \n    \/\/\u9045\u5ef6\u95a2\u6570\n    function delay(ms) {\n      return new Promise(resolve => setTimeout(resolve, ms));\n    }\n  <\/script>","protected":false},"excerpt":{"rendered":"SVG\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\uff08CSS\u30fbSMIL\uff09\u3092\u30c9\u30ed\u30c3\u30d7\u3057\u3066\u3001GIF\u753b\u50cf\u306b\u5909\u63db\u30fb\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u30c4\u30fc\u30eb\u3002\u30d5\u30ec\u30fc\u30e0\u6570\u30fb\u518d\u751f\u6642\u9593\u30fb\u30b9\u30b1\u30fc\u30eb\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002","protected":false},"author":1,"featured_media":13929,"parent":173,"menu_order":58,"comment_status":"closed","ping_status":"closed","template":"templates\/page-converter.php","meta":{"_acf_changed":false,"footnotes":""},"categories":[16,12],"tags":[],"group":[],"pg":[],"class_list":["post-9036","page","type-page","status-publish","has-post-thumbnail","category-tool","category-mediaedit"],"acf":[],"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pages\/9036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=9036"}],"version-history":[{"count":0,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pages\/9036\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pages\/173"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/13929"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=9036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=9036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=9036"},{"taxonomy":"group","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/group?post=9036"},{"taxonomy":"pg","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pg?post=9036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}