<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to show GIF through dynamiclayer？ in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-show-gif-through-dynamiclayer/m-p/1174061#M77311</link>
    <description>&lt;P&gt;I use&lt;SPAN&gt;BaseDynamicLayer&lt;/SPAN&gt;.&lt;SPAN&gt;createSubclass&amp;nbsp;&lt;/SPAN&gt;to create a layer with a picture. If the picture is static, it can work normally, but if the picture is GIF, only the first frame will be displayed.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let layerClass = BaseDynamicLayer.createSubclass({
      // override BaseDynamicLayer methods
      getImageUrl(extent, width, height) {
        return imgUrl
      },

      // override BaseDynamicLayer methods
      fetchImage(extent, width, height) {
        let url = this.getImageUrl(extent, width, height)
          return new Promise((resolve) =&amp;gt; {
            self._requestImg(url).then(data =&amp;gt; {
              let img = data

              let cvs = document.createElement('canvas')
              let context = cvs.getContext('2d')
              cvs.width = width
              cvs.height = height

              // context.fillStyle = '#000'
              // context.fillRect(0, 0, width, height)
              // context.globalCompositeOperation = 'destination-atop'
              const pos = self._computePosition(extent, width, height)
              // console.log(pos)
              // const sPos = self.mapView.toScreen({
              //   x: pos.x,
              //   y: pos.y,
              //   spatialReference: {wkid: 4326}
              // })
              context.drawImage(img, pos.x, pos.y, pos.width, pos.height)
              // context.drawImage(img, 0, 0, width, height)

              resolve(cvs)
            })
          })
      }
    })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 May 2022 04:31:21 GMT</pubDate>
    <dc:creator>ZhouYC</dc:creator>
    <dc:date>2022-05-16T04:31:21Z</dc:date>
    <item>
      <title>How to show GIF through dynamiclayer？</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-show-gif-through-dynamiclayer/m-p/1174061#M77311</link>
      <description>&lt;P&gt;I use&lt;SPAN&gt;BaseDynamicLayer&lt;/SPAN&gt;.&lt;SPAN&gt;createSubclass&amp;nbsp;&lt;/SPAN&gt;to create a layer with a picture. If the picture is static, it can work normally, but if the picture is GIF, only the first frame will be displayed.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let layerClass = BaseDynamicLayer.createSubclass({
      // override BaseDynamicLayer methods
      getImageUrl(extent, width, height) {
        return imgUrl
      },

      // override BaseDynamicLayer methods
      fetchImage(extent, width, height) {
        let url = this.getImageUrl(extent, width, height)
          return new Promise((resolve) =&amp;gt; {
            self._requestImg(url).then(data =&amp;gt; {
              let img = data

              let cvs = document.createElement('canvas')
              let context = cvs.getContext('2d')
              cvs.width = width
              cvs.height = height

              // context.fillStyle = '#000'
              // context.fillRect(0, 0, width, height)
              // context.globalCompositeOperation = 'destination-atop'
              const pos = self._computePosition(extent, width, height)
              // console.log(pos)
              // const sPos = self.mapView.toScreen({
              //   x: pos.x,
              //   y: pos.y,
              //   spatialReference: {wkid: 4326}
              // })
              context.drawImage(img, pos.x, pos.y, pos.width, pos.height)
              // context.drawImage(img, 0, 0, width, height)

              resolve(cvs)
            })
          })
      }
    })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 04:31:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-show-gif-through-dynamiclayer/m-p/1174061#M77311</guid>
      <dc:creator>ZhouYC</dc:creator>
      <dc:date>2022-05-16T04:31:21Z</dc:date>
    </item>
  </channel>
</rss>

