Git Product home page Git Product logo

Comments (8)

xyy94813 avatar xyy94813 commented on September 27, 2024

有可能是声明错误、也可能是api升级了。
由于多种原因(网线还没拉),最近一周我这边抽不出空余时间解决该问题。
(因为文档细节错误很多,验证比较耗时)

如果,着急的话,欢迎 PR。


修复此问题的一些建议:

PR 时附带这些信息可以帮助我快速验证。
代码合并后,可以快速触发CI发布 hotfix。

from amap-jsapi-v2-types.

sakura-Joker avatar sakura-Joker commented on September 27, 2024

官方ts声明文档并没有看见MoveAlongOptions类型定义
在示例中
image
轨迹回放动画平滑
image
若给easing加上该函数可运行
在export type EasingCallback = (passedTime?: number) => number; 感觉passedTime可选操作符需去掉 若是提供默认值为0 则动画的进度都会被重置为起点

from amap-jsapi-v2-types.

xyy94813 avatar xyy94813 commented on September 27, 2024

我这边不确定是否提供默认值0。
能否提供你这边验证成功的完整示例呢?


另外,你也可以参考下 Marker 的实现,先实现个 Marker2 作为过渡方案。

我是提供了扩展组件的机制的

from amap-jsapi-v2-types.

sakura-Joker avatar sakura-Joker commented on September 27, 2024

感觉改成export type EasingCallback = (passedTime: number) => number; 就可以了 就是去掉问号 提供默认值为0是因为您定义得passedTime为可选项 所以我如果想运行该代码 只能当null 或者undefined提供默认值0
image
而如果使用该函数 则无法进行动画

from amap-jsapi-v2-types.

xyy94813 avatar xyy94813 commented on September 27, 2024

MoveAlongOptions

这个问题是 moveAlone 函数的 options 参数的类型中 easing 是必填项你缺少了。

官方ts声明文档并没有看见MoveAlongOptions类型定义

官方文档里有提到动画的相关定义:
https://lbs.amap.com/api/javascript-api-v2/documentation#moveanimation

感觉改成export type EasingCallback = (passedTime: number) => number;

错误方向找错了。
我期望的是计算支持与传递关系无关:

const bizModelObj = { speed: 10 }
const obj: MoveAlongOptions = { 
  easing: () => {
    return bizModelObj[speed]
  }
}

官方示例中moveAlong的MoveAlongOptions easing参数并不是必填的

我印象中,我验证的时候不填会直接挂掉。我这两天抽空验证一下。

from amap-jsapi-v2-types.

xyy94813 avatar xyy94813 commented on September 27, 2024

经验证默认为 Linear

可能还支持以下字符配置,需确认验证

var Easing = {
  LINEAR: "Linear",
  QUADRATIC_IN: "QuadraticIn",
  QUADRATIC_OUT: "QuadraticOut",
  QUADRATIC_IN_OUT: "QuadraticInOut",
  CUBIC_IN: "CubicIn",
  CUBIC_OUT: "CubicOut",
  CUBIC_IN_OUT: "CubicInOut",
  QUARTIC_IN: "QuarticIn",
  QUARTIC_OUT: "QuarticOut",
  QUARTIC_IN_OUT: "QuarticInOut",
  QUINTIC_IN: "QuinticIn",
  QUINTIC_OUT: "QuinticOut",
  QUINTIC_IN_OUT: "QuinticInOut",
  SINUSOIDAL_IN: "SinusoidalIn",
  SINUSOIDAL_OUT: "SinusoidalOut",
  SINUSOIDAL_IN_OUT: "SinusoidalInOut",
  EXPONENTIAL_IN: "ExponentialIn",
  EXPONENTIAL_OUT: "ExponentialOut",
  EXPONENTIAL_IN_OUT: "ExponentialInOut",
  CIRCULAR_IN: "CircularIn",
  CIRCULAR_OUT: "CircularOut",
  CIRCULAR_IN_OUT: "CircularInOut",
  ELASTIC_IN: "ElasticIn",
  ELASTIC_OUT: "ElasticOut",
  ELASTIC_IN_OUT: "ElasticInOut",
  BACK_IN: "BackIn",
  BACK_OUT: "BackOut",
  BACK_IN_OUT: "BackInOut",
  BOUNCE_IN: "BounceIn",
  BOUNCE_OUT: "BounceOut",
  BOUNCE_IN_OUT: "BounceInOut"
};

from amap-jsapi-v2-types.

sakura-Joker avatar sakura-Joker commented on September 27, 2024

所以我是要这样写吗
const bizModelObj = { speed: 10 } const obj: MoveAlongOptions = { easing: () => { return bizModelObj[speed] } }

from amap-jsapi-v2-types.

xyy94813 avatar xyy94813 commented on September 27, 2024

所以我是要这样写吗

`const bizModelObj = { speed: 10 }

const obj: MoveAlongOptions = {

easing: () => {

return bizModelObj[speed]

}

}`

对的。


你看下最新的release修改了这个约束

from amap-jsapi-v2-types.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.