Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
How to show GIF through dynamiclayer?

I useBaseDynamicLayer.createSubclass 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.😥

Here is my code:

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) => {
        self._requestImg(url).then(data => {
          let img = data
          let cvs = document.createElement('canvas')
          let context = cvs.getContext('2d')
          cvs.width = width
          cvs.height = height
          const pos = self._computePosition(extent, width, height)
          context.drawImage(img, pos.x, pos.y, pos.width, pos.height)
          resolve(cvs)
        })
      })
  }
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!