#921·velocity

Chaining produces error "e.replace is not a function."

Author: crackwildingCreated Jul 31, 2020Updated Oct 30, 2020

Your system information

  • VelocityJS version: 2.06
  • Browser: Chrome
  • Operating System: OSX

I have code in a class that looks like this:

    this.image.velocity('property', { 
      left: (mousepos[0] - 6) + 'px',
      top: (mousepos[1] - 24) + 'px',
      opacity: 1
    }).velocity(
      { 
        left: (mousepos[0] - 6 + dest[0]) + 'px',
        top: (mousepos[1] - 24 - dest[1]) + 'px',
        opacity: 0
      },
      { duration: 3000 }
    );

When I run it it tells me "Uncaught TypeError: e.replace is not a function." This is in velocity.min.js, line 6, and the stack shows calling function as the second velocity call above. mousepos is a two-element array of screen x and y, as is dest. If I take out the opacity value in the second call, it works fine.