Comments (8)
有可能是声明错误、也可能是api升级了。
由于多种原因(网线还没拉),最近一周我这边抽不出空余时间解决该问题。
(因为文档细节错误很多,验证比较耗时)
如果,着急的话,欢迎 PR。
修复此问题的一些建议:
- 确认 js-api-v2 的参考手册。(https://lbs.amap.com/api/javascript-api-v2/documentation)
- 参考官方的 ts 声明文档是否存在问题
- 查看 uglify 后的运行代码确认
- 编写边界测试用例验证
PR 时附带这些信息可以帮助我快速验证。
代码合并后,可以快速触发CI发布 hotfix。
from amap-jsapi-v2-types.
官方ts声明文档并没有看见MoveAlongOptions类型定义
在示例中
轨迹回放动画平滑
若给easing加上该函数可运行
在export type EasingCallback = (passedTime?: number) => number; 感觉passedTime可选操作符需去掉 若是提供默认值为0 则动画的进度都会被重置为起点
from amap-jsapi-v2-types.
我这边不确定是否提供默认值0。
能否提供你这边验证成功的完整示例呢?
另外,你也可以参考下 Marker 的实现,先实现个 Marker2 作为过渡方案。
我是提供了扩展组件的机制的
from amap-jsapi-v2-types.
感觉改成export type EasingCallback = (passedTime: number) => number; 就可以了 就是去掉问号 提供默认值为0是因为您定义得passedTime为可选项 所以我如果想运行该代码 只能当null 或者undefined提供默认值0
而如果使用该函数 则无法进行动画
from amap-jsapi-v2-types.
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.
经验证默认为 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.
所以我是要这样写吗
const bizModelObj = { speed: 10 } const obj: MoveAlongOptions = { easing: () => { return bizModelObj[speed] } }
from amap-jsapi-v2-types.
所以我是要这样写吗
`const bizModelObj = { speed: 10 }
const obj: MoveAlongOptions = {
easing: () => {
return bizModelObj[speed]
}
}`
对的。
你看下最新的release修改了这个约束
from amap-jsapi-v2-types.
Related Issues (8)
- [Bug] AMap.DistrictLayer 下所有 `Word` 应为 `World` HOT 1
- [bug] 类型“typeof AMap”上不存在属性“GeometryUtil” 以及LabelsLayer HOT 1
- [BUG] 类型“typeof AMap”上不存在属性“GeometryUtil”
- [BUG] 命名空间“global.AMap”没有已导出的成员“LabelsLayer” HOT 1
- 多边形编辑器的类名是PolyEditor还是PolygonEditor? HOT 1
- [BUG] 类型 “InfoWindow”上缺少属性“setExtData” HOT 2
- labelsLayer.value?.getAllOverlays().forEach的每个标注点对象没有setIcon setTop方法 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amap-jsapi-v2-types.