@visactor/vrender-core 0.21.9-alpha.1 → 0.21.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate/animate.js +1 -1
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/common/render-area.d.ts +0 -4
- package/cjs/common/render-area.js +16 -76
- package/cjs/common/render-area.js.map +1 -1
- package/cjs/common/render-curve.d.ts +1 -1
- package/cjs/common/render-curve.js.map +1 -1
- package/cjs/common/segment/step.js +1 -1
- package/cjs/common/segment/step.js.map +1 -1
- package/cjs/graphic/line.js +2 -2
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/interface/color.js.map +1 -1
- package/cjs/interface/graphic/richText.js.map +1 -1
- package/cjs/interface/graphic.d.ts +1 -1
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/render/contributions/render/area-render.d.ts +1 -1
- package/cjs/render/contributions/render/area-render.js +16 -36
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +9 -31
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/dist/index.es.js +85 -313
- package/es/animate/animate.js +4 -3
- package/es/animate/animate.js.map +1 -1
- package/es/common/render-area.d.ts +0 -4
- package/es/common/render-area.js +16 -76
- package/es/common/render-area.js.map +1 -1
- package/es/common/render-curve.d.ts +1 -1
- package/es/common/render-curve.js.map +1 -1
- package/es/common/segment/step.js +1 -1
- package/es/common/segment/step.js.map +1 -1
- package/es/graphic/line.js +2 -2
- package/es/graphic/line.js.map +1 -1
- package/es/interface/color.js.map +1 -1
- package/es/interface/graphic/richText.js.map +1 -1
- package/es/interface/graphic.d.ts +1 -1
- package/es/interface/graphic.js.map +1 -1
- package/es/render/contributions/render/area-render.d.ts +1 -1
- package/es/render/contributions/render/area-render.js +16 -36
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +9 -31
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/package.json +1 -1
package/cjs/animate/animate.js
CHANGED
|
@@ -58,7 +58,7 @@ exports.CbAnimate = CbAnimate;
|
|
|
58
58
|
|
|
59
59
|
class Animate {
|
|
60
60
|
constructor(id = generator_1.Generator.GenAutoIncrementId(), timeline = timeline_1.defaultTimeline, slience) {
|
|
61
|
-
this.id = id, this.timeline = timeline, this.status = enums_1.AnimateStatus.INITIAL,
|
|
61
|
+
this.id = id, this.timeline = timeline || timeline_1.defaultTimeline, this.status = enums_1.AnimateStatus.INITIAL,
|
|
62
62
|
this.tailAnimate = new SubAnimate(this), this.subAnimates = [ this.tailAnimate ],
|
|
63
63
|
this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0,
|
|
64
64
|
this.timeline.addAnimate(this), this.slience = slience;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animate/animate.ts"],"names":[],"mappings":";;;AAaA,2CAAmG;AACnG,qCAAkC;AAClC,6CAA+C;AAC/C,yCAA6C;AAC7C,mDAAgD;AA2BhD,MAAsB,cAAc;IAgBlC,YAAY,IAAO,EAAE,EAAK,EAAE,QAAgB,EAAE,MAAkB,EAAE,MAAY;QAC5E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,MAAsB,EAAE,MAAmB;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAGD,MAAM;QACJ,OAAO;IACT,CAAC;IAGD,UAAU;QACR,OAAO;IACT,CAAC;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AAG,CAAC,CAAC;IAC3D,CAAC;CACF;AA/YD,gCA+YC;AAmUD,MAAM,IAAI;IAiBR,YAAY,QAAgB,EAAE,QAAgB,EAAE,KAAW,EAAE,MAAuB;QAClF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,IAAU;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,YAAY;QACV,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,OAAO,IAAI,EAAE;YACX,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC,KAAK,CAAC;aACnB;iBAAM,IAAI,IAAI,CAAC,aAAa,EAAE;gBAC7B,OAAO,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,CAAC;aAC/C;YACD,IAAI,GAAG,IAAI,CAAC,IAAW,CAAC;SACzB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"animate.js","sourcesContent":["import type {\n EasingType,\n EasingTypeFunc,\n IAnimate,\n IAnimateStepType,\n IAnimateTarget,\n ICustomAnimate,\n IGraphic,\n IStep,\n IStepConfig,\n ISubAnimate,\n ITimeline\n} from '../interface';\nimport { AnimateMode, AnimateStatus, AnimateStepType, AttributeUpdateType } from '../common/enums';\nimport { Easing } from './easing';\nimport { Logger, max } from '@visactor/vutils';\nimport { defaultTimeline } from './timeline';\nimport { Generator } from '../common/generator';\n\n// 参考TweenJS\n// https://github.com/CreateJS/TweenJS/tree/master/src/tweenjs\n/**\n * The MIT License (MIT)\n\n Copyright (c) 2014 gskinner.com, inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\nexport abstract class ACustomAnimate<T> implements ICustomAnimate {\n declare from: T;\n declare to: T;\n declare duration: number;\n declare easing: EasingType;\n declare params: any;\n declare target: IAnimateTarget;\n declare updateCount: number;\n declare subAnimate: ISubAnimate;\n declare step?: IStep;\n declare mode?: AnimateMode;\n\n // 用于判断是否一致\n declare _endProps?: any;\n declare _mergedEndProps?: any;\n\n constructor(from: T, to: T, duration: number, easing: EasingType, params?: any) {\n this.from = from;\n this.to = to;\n this.duration = duration;\n this.easing = easing;\n this.params = params;\n this.updateCount = 0;\n }\n\n bind(target: IAnimateTarget, subAni: ISubAnimate) {\n this.target = target;\n this.subAnimate = subAni;\n this.onBind();\n }\n\n // 在第一次调用的时候触发\n onBind() {\n return;\n }\n\n // 第一次执行的时候调用\n onFirstRun() {\n return;\n }\n\n // 开始执行的时候调用(如果有循环,那每个周期都会调用)\n onStart() {\n return;\n }\n\n // 结束执行的时候调用(如果有循环,那每个周期都会调用)\n onEnd() {\n return;\n }\n\n getEndProps(): Record<string, any> | void {\n return this.to;\n }\n\n getFromProps(): Record<string, any> | void {\n return this.from;\n }\n\n getMergedEndProps(): Record<string, any> | void {\n const thisEndProps = this.getEndProps();\n if (thisEndProps) {\n if (this._endProps === thisEndProps) {\n return this._mergedEndProps;\n }\n this._endProps = thisEndProps;\n this._mergedEndProps = Object.assign({}, this.step.prev.getLastProps() ?? {}, thisEndProps);\n return;\n }\n return this.step.prev ? this.step.prev.getLastProps() : thisEndProps;\n }\n\n // abstract getFromValue(key: string): any;\n // abstract getToValue(key: string): any;\n\n abstract onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this.updateCount === 0) {\n this.onFirstRun();\n // out添加之前的props\n const props = this.step.getLastProps();\n Object.keys(props).forEach(k => {\n if (this.subAnimate.animate.validAttr(k)) {\n out[k] = props[k];\n }\n });\n }\n this.updateCount += 1;\n this.onUpdate(end, ratio, out);\n if (end) {\n this.onEnd();\n }\n }\n}\n\nexport class CbAnimate extends ACustomAnimate<null> {\n cb: () => void;\n\n constructor(cb: () => void) {\n super(null, null, 0, 'linear');\n this.cb = cb;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n return;\n }\n\n onStart(): void {\n this.cb();\n }\n}\n\ntype InterpolateFunc = (\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IAnimateTarget,\n out: Record<string, any>\n) => boolean;\n\nexport class Animate implements IAnimate {\n static mode: AnimateMode = AnimateMode.NORMAL;\n declare target: IAnimateTarget;\n declare timeline: ITimeline;\n declare nextAnimate?: IAnimate;\n declare prevAnimate?: IAnimate;\n // 当前Animate的状态,正常,暂停,结束\n declare status: AnimateStatus;\n declare readonly id: string | number;\n // 开始时间\n protected declare _startTime: number;\n protected declare _duringTime: number;\n declare subAnimates: SubAnimate[];\n declare tailAnimate: SubAnimate;\n\n // 绝对的位置\n declare rawPosition: number;\n // 时间倍速缩放\n declare timeScale: number;\n\n declare interpolateFunc: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n\n declare _onStart?: (() => void)[];\n declare _onFrame?: ((step: IStep, ratio: number) => void)[];\n declare _onEnd?: (() => void)[];\n declare _onRemove?: (() => void)[];\n declare _preventAttrs?: Set<string>;\n static interpolateMap: Map<string, InterpolateFunc> = new Map();\n slience?: boolean;\n\n constructor(\n id: string | number = Generator.GenAutoIncrementId(),\n timeline: ITimeline = defaultTimeline,\n slience?: boolean\n ) {\n this.id = id;\n this.timeline = timeline;\n this.status = AnimateStatus.INITIAL;\n this.tailAnimate = new SubAnimate(this);\n this.subAnimates = [this.tailAnimate];\n this.timeScale = 1;\n this.rawPosition = -1;\n this._startTime = 0;\n this._duringTime = 0;\n this.timeline.addAnimate(this);\n this.slience = slience;\n }\n\n setTimeline(timeline: ITimeline) {\n if (timeline === this.timeline) {\n return;\n }\n this.timeline.removeAnimate(this, false);\n timeline.addAnimate(this);\n }\n\n getStartTime(): number {\n return this._startTime;\n }\n\n getDuration(): number {\n return this.subAnimates.reduce((t, subAnimate) => t + subAnimate.totalDuration, 0);\n }\n\n after(animate: IAnimate) {\n const t = animate.getDuration();\n this._startTime = t;\n return this;\n }\n\n afterAll(list: IAnimate[]) {\n let maxT = -Infinity;\n list.forEach(a => {\n maxT = max(a.getDuration(), maxT);\n });\n this._startTime = maxT;\n return this;\n }\n\n parallel(animate: IAnimate) {\n this._startTime = animate.getStartTime();\n return this;\n }\n\n static AddInterpolate(name: string, cb: InterpolateFunc) {\n Animate.interpolateMap.set(name, cb);\n }\n\n play(customAnimate: ICustomAnimate) {\n this.tailAnimate.play(customAnimate);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n if (this.subAnimates.length === 1 && this.tailAnimate.totalDuration === customAnimate.duration) {\n this.trySetAttribute(customAnimate.getFromProps(), customAnimate.mode);\n }\n return this;\n }\n\n trySetAttribute(attr: Record<string, any> | void, mode: AnimateMode = Animate.mode) {\n if (attr && mode & AnimateMode.SET_ATTR_IMMEDIATELY) {\n (this.target as any).setAttributes &&\n (this.target as any).setAttributes(attr, false, { type: AttributeUpdateType.ANIMATE_PLAY });\n }\n }\n\n runCb(cb: (a: IAnimate, step: IStep) => void) {\n // this.tailAnimate.runCb(cb);\n const customAnimate = new CbAnimate(() => {\n cb(this, customAnimate.step.prev);\n });\n this.tailAnimate.play(customAnimate);\n return this;\n }\n\n /**\n * 自定义插值,返回false表示没有匹配上\n * @param key\n * @param from\n * @param to\n */\n customInterpolate(\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IAnimateTarget,\n ret: Record<string, any>\n ): boolean {\n const func = Animate.interpolateMap.get(key) || Animate.interpolateMap.get('');\n if (!func) {\n return false;\n }\n return func(key, ratio, from, to, target, ret);\n }\n\n pause() {\n if (this.status === AnimateStatus.RUNNING) {\n this.status = AnimateStatus.PAUSED;\n }\n }\n\n resume() {\n if (this.status === AnimateStatus.PAUSED) {\n this.status = AnimateStatus.RUNNING;\n }\n }\n\n to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n this.tailAnimate.to(props, duration, easing, params);\n // 默认开始动画\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n // if (this.subAnimates.length === 1 && this.tailAnimate.duration === duration) {\n // this.trySetAttribute(props);\n // }\n return this;\n }\n from(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n this.tailAnimate.from(props, duration, easing, params);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n wait(duration: number) {\n this.tailAnimate.wait(duration);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n startAt(t: number) {\n this.tailAnimate.startAt(t);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n loop(l: number) {\n this.tailAnimate.loop = l;\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n reversed(r: boolean) {\n this.tailAnimate.reversed = r;\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n bounce(b: boolean) {\n this.tailAnimate.bounce = b;\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n subAnimate() {\n const sa = new SubAnimate(this, this.tailAnimate);\n this.tailAnimate = sa;\n this.subAnimates.push(sa);\n sa.bind(this.target);\n return this;\n }\n\n getStartProps(): Record<string, any> {\n return this.subAnimates[0].getStartProps();\n }\n\n getEndProps(): Record<string, any> {\n return this.tailAnimate.getEndProps();\n }\n\n depreventAttr(key: string) {\n if (!this._preventAttrs) {\n return;\n }\n this._preventAttrs.delete(key);\n }\n preventAttr(key: string) {\n if (!this._preventAttrs) {\n this._preventAttrs = new Set();\n }\n this._preventAttrs.add(key);\n }\n preventAttrs(keys: string[]) {\n keys.forEach(key => this.preventAttr(key));\n }\n validAttr(key: string): boolean {\n if (!this._preventAttrs) {\n return true;\n }\n return !this._preventAttrs.has(key);\n }\n\n bind(target: IAnimateTarget) {\n this.target = target;\n\n if (this.target.onAnimateBind && !this.slience) {\n this.target.onAnimateBind(this);\n }\n\n this.subAnimates.forEach(sa => {\n sa.bind(target);\n });\n return this;\n }\n\n advance(delta: number) {\n // startTime之前的时间不计入耗时\n if (this._duringTime < this._startTime) {\n if (this._duringTime + delta * this.timeScale < this._startTime) {\n this._duringTime += delta * this.timeScale;\n return;\n }\n delta = this._duringTime + delta * this.timeScale - this._startTime;\n this._duringTime = this._startTime;\n }\n // 执行advance\n if (this.status === AnimateStatus.INITIAL) {\n this.status = AnimateStatus.RUNNING;\n this._onStart && this._onStart.forEach(cb => cb());\n }\n const end = this.setPosition(Math.max(this.rawPosition, 0) + delta * this.timeScale);\n if (end && this.status === AnimateStatus.RUNNING) {\n this.status = AnimateStatus.END;\n this._onEnd && this._onEnd.forEach(cb => cb());\n }\n }\n\n setPosition(rawPosition: number): boolean {\n let d = 0;\n let sa: SubAnimate | undefined;\n const prevRawPos = this.rawPosition;\n const maxRawPos = this.subAnimates.reduce((a, b) => a + b.totalDuration, 0);\n\n if (rawPosition < 0) {\n rawPosition = 0;\n }\n\n const end = rawPosition >= maxRawPos;\n\n if (end) {\n rawPosition = maxRawPos;\n }\n\n if (rawPosition === prevRawPos) {\n return end;\n }\n\n // 查找对应的subAnimate\n for (let i = 0; i < this.subAnimates.length; i++) {\n sa = this.subAnimates[i];\n if (d + sa.totalDuration >= rawPosition) {\n break;\n } else {\n d += sa.totalDuration;\n sa = undefined;\n }\n }\n this.rawPosition = rawPosition;\n sa.setPosition(rawPosition - d);\n\n return end;\n }\n\n onStart(cb: () => void) {\n if (!this._onStart) {\n this._onStart = [];\n }\n this._onStart.push(cb);\n }\n onEnd(cb: () => void) {\n if (!this._onEnd) {\n this._onEnd = [];\n }\n this._onEnd.push(cb);\n }\n onRemove(cb: () => void) {\n if (!this._onRemove) {\n this._onRemove = [];\n }\n this._onRemove.push(cb);\n }\n onFrame(cb: (step: IStep, ratio: number) => void) {\n if (!this._onFrame) {\n this._onFrame = [];\n }\n this._onFrame.push(cb);\n }\n release() {\n this.status = AnimateStatus.END;\n return;\n }\n\n stop(nextVal?: 'start' | 'end' | Record<string, any>) {\n if (!nextVal) {\n this.target.onStop();\n }\n if (nextVal === 'start') {\n this.target.onStop(this.getStartProps());\n } else if (nextVal === 'end') {\n this.target.onStop(this.getEndProps());\n } else {\n this.target.onStop(nextVal);\n }\n this.release();\n }\n}\n\n// Animate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nexport class SubAnimate implements ISubAnimate {\n declare target: IAnimateTarget;\n declare animate: IAnimate;\n // 默认的初始step,一定存在,且stepHead的props一定保存整个subAnimate阶段所有属性的最初\n protected declare stepHead: Step;\n protected declare stepTail: Step;\n // 结束时反转动画\n declare bounce: boolean;\n // 是否reverse\n declare reversed: boolean;\n // 循环次数,0为执行一次,1为执行两次,Infinity为无限循环\n declare loop: number;\n // 持续时间,不包括循环\n declare duration: number;\n // 位置,在[0, duration]之间\n declare position: number;\n // 绝对的位置,在[0, loops * duration]之间\n declare rawPosition: number;\n declare dirty: boolean;\n\n declare _totalDuration: number;\n declare _startAt: number;\n declare _lastStep: IStep;\n declare _deltaPosition: number;\n\n get totalDuration(): number {\n this.calcAttr();\n return this._totalDuration + this._startAt;\n }\n\n constructor(animate: IAnimate, lastSubAnimate?: SubAnimate) {\n this.rawPosition = -1;\n this.position = 0;\n this.loop = 0;\n this.duration = 0;\n this.animate = animate;\n if (lastSubAnimate) {\n this.stepHead = new Step(0, 0, Object.assign({}, lastSubAnimate.stepTail.props));\n } else {\n this.stepHead = new Step(0, 0, {});\n }\n this.stepTail = this.stepHead;\n this.dirty = true;\n this._startAt = 0;\n }\n\n // 计算按需计算的属性\n protected calcAttr() {\n if (!this.dirty) {\n return;\n }\n\n this._totalDuration = this.duration * (this.loop + 1);\n }\n\n bind(target: IAnimateTarget) {\n this.target = target;\n return this;\n }\n\n play(customAnimate: ICustomAnimate) {\n let duration = customAnimate.duration;\n if (duration == null || duration < 0) {\n duration = 0;\n }\n const easing = customAnimate.easing;\n const easingFunc = typeof easing === 'string' ? Easing[easing] : easing;\n const step = this._addStep(duration, null, easingFunc);\n step.type = AnimateStepType.customAnimate;\n this._appendProps(customAnimate.getEndProps(), step, false);\n this._appendCustomAnimate(customAnimate, step);\n return this;\n }\n\n // _appendPlayProps(step: IStep) {\n\n // return;\n // }\n\n to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n if (duration == null || duration < 0) {\n duration = 0;\n }\n\n const easingFunc = typeof easing === 'string' ? Easing[easing] : easing;\n\n const step = this._addStep(duration, null, easingFunc);\n step.type = AnimateStepType.to;\n this._appendProps(props, step, params ? params.tempProps : false);\n // this._appendPlayProps(step);\n\n if (!step.propKeys) {\n step.propKeys = Object.keys(step.props);\n }\n if (!(params && params.noPreventAttrs)) {\n this.target.animates.forEach(a => {\n if (a.id !== this.animate.id) {\n a.preventAttrs(step.propKeys);\n }\n });\n }\n return this;\n }\n\n from(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n this.to(props, 0, easing, params);\n const toProps = {};\n if (!this.stepTail.propKeys) {\n this.stepTail.propKeys = Object.keys(this.stepTail.props);\n }\n this.stepTail.propKeys.forEach(k => {\n toProps[k] = this.getLastPropByName(k, this.stepTail);\n });\n this.to(toProps, duration, easing, params);\n this.stepTail.type = AnimateStepType.from;\n }\n\n startAt(t: number) {\n if (t < 0) {\n t = 0;\n }\n this._startAt = t;\n return this;\n }\n\n getStartProps() {\n return this.stepHead?.props;\n }\n\n getEndProps() {\n return this.stepTail.props;\n }\n\n getLastStep() {\n return this._lastStep;\n }\n\n wait(duration: number) {\n if (duration > 0) {\n const step = this._addStep(+duration, null);\n\n step.type = AnimateStepType.wait;\n // TODO 这里如果跳帧的话会存在bug\n if (step.prev.customAnimate) {\n step.props = step.prev.customAnimate.getEndProps();\n } else {\n step.props = step.prev.props;\n }\n if (this.target.onAddStep) {\n this.target.onAddStep(step);\n }\n // this._appendPlayProps(step);\n }\n return this;\n }\n\n protected _addStep(duration: number, props: any, easingFunc?: EasingTypeFunc) {\n const step = new Step(this.duration, duration, props, easingFunc);\n this.duration += duration;\n this.stepTail.append(step);\n this.stepTail = step;\n return step;\n }\n\n protected _appendProps(props: any, step: Step, tempProps?: boolean) {\n if (tempProps) {\n step.props = props;\n } else {\n // todo: 是否需要深拷贝props\n step.props = Object.assign({}, props);\n }\n let lastStep = step.prev;\n const _props = step.props;\n // 将undefined的属性设置到默认值\n if (!step.propKeys) {\n step.propKeys = Object.keys(step.props);\n }\n step.propKeys.forEach(k => {\n if (step.props[k] === undefined) {\n step.props[k] = this.target.getDefaultAttribute(k);\n }\n });\n // 拷贝之前的step阶段属性\n while (lastStep.prev) {\n if (lastStep.props) {\n if (!lastStep.propKeys) {\n lastStep.propKeys = Object.keys(lastStep.props);\n }\n lastStep.propKeys.forEach(key => {\n if (_props[key] === undefined) {\n _props[key] = lastStep.props[key];\n }\n });\n }\n // 重置propKeys\n step.propKeys = Object.keys(step.props);\n lastStep = lastStep.prev;\n }\n\n // 设置最初的props属性\n const initProps = this.stepHead.props;\n if (!step.propKeys) {\n step.propKeys = Object.keys(_props);\n }\n step.propKeys.forEach(key => {\n if (initProps[key] === undefined) {\n const parentAnimateInitProps = this.animate.getStartProps();\n initProps[key] = parentAnimateInitProps[key] = this.target.getComputedAttribute(key);\n }\n });\n\n if (this.target.onAddStep) {\n this.target.onAddStep(step);\n }\n }\n\n protected _appendCustomAnimate(customAnimate: ICustomAnimate, step: Step) {\n step.customAnimate = customAnimate;\n customAnimate.step = step;\n customAnimate.bind(this.target, this);\n }\n\n setPosition(rawPosition: number) {\n const d = this.duration;\n const loopCount = this.loop;\n const prevRawPos = this.rawPosition;\n let end = false;\n let loop: number; // 当前是第几次循环\n let position: number; // 当前周期的时间\n const startAt = this._startAt ?? 0;\n\n if (rawPosition < 0) {\n rawPosition = 0;\n }\n if (rawPosition < startAt) {\n this.rawPosition = rawPosition;\n return false;\n }\n rawPosition = rawPosition - startAt;\n if (d <= 0) {\n // 如果不用执行,跳过\n end = true;\n // 小于0的话,直接return,如果等于0,那还是得走动画逻辑,将end属性设置上去\n if (d < 0) {\n return end;\n }\n }\n loop = Math.floor(rawPosition / d);\n position = rawPosition - loop * d;\n\n // 计算rawPosition\n end = rawPosition >= loopCount * d + d;\n // 如果结束,跳过\n if (end) {\n position = d;\n loop = loopCount;\n rawPosition = position * loop + d;\n }\n\n if (rawPosition === prevRawPos) {\n return end;\n }\n\n // reverse动画\n const rev = !this.reversed !== !(this.bounce && loop % 2);\n if (rev) {\n position = d - position;\n }\n\n this._deltaPosition = position - this.position;\n this.position = position;\n this.rawPosition = rawPosition + startAt;\n\n this.updatePosition(end, rev);\n\n return end;\n }\n\n protected updatePosition(end: boolean, rev: boolean) {\n if (!this.stepHead) {\n return;\n }\n let step = this.stepHead.next;\n const position = this.position;\n const duration = this.duration;\n if (this.target && step) {\n let stepNext = step.next;\n while (stepNext && stepNext.position <= position) {\n step = stepNext;\n stepNext = step.next;\n }\n let ratio = end ? (duration === 0 ? 1 : position / duration) : (position - step.position) / step.duration; // TODO: revisit this.\n if (step.easing) {\n ratio = step.easing(ratio);\n }\n // 判断这次和上次过程中是否经历了自定义step,如果跳过了自定义step那么执行自定义step的onEnd\n this.tryCallCustomAnimateLifeCycle(step, this._lastStep || (rev ? this.stepTail : this.stepHead), rev);\n // if (step !== this._lastStep) {\n // if (this._deltaPosition > 0) {\n // let _step = step.prev;\n // while (_step && _step !== this._lastStep) {\n // if (_step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // _step = _step.prev;\n // }\n // if (_step && _step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // } else if (this._deltaPosition < 0) {\n // let _step = step.next;\n // while (_step && _step !== this._lastStep) {\n // if (_step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // _step = _step.next;\n // }\n // if (_step && _step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // }\n // }\n this.updateTarget(step, ratio, end);\n this._lastStep = step;\n\n this.animate._onFrame && this.animate._onFrame.forEach(cb => cb(step, ratio));\n }\n }\n\n // 如果动画卡顿跳过了自定义动画,那么尝试执行自定义动画的生命周期\n tryCallCustomAnimateLifeCycle(step: IStep, lastStep: IStep, rev: boolean) {\n if (step === lastStep) {\n return;\n }\n if (rev) {\n let _step = lastStep.prev;\n while (_step && _step !== step) {\n if (_step.customAnimate) {\n _step.customAnimate.onStart && _step.customAnimate.onStart();\n _step.customAnimate.onEnd && _step.customAnimate.onEnd();\n }\n _step = step.prev;\n }\n // 执行lastStep的onEnd和currentStep的onStart\n if (lastStep && lastStep.customAnimate) {\n lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd();\n }\n if (step && step.customAnimate) {\n step.customAnimate.onStart && step.customAnimate.onStart();\n }\n } else {\n let _step = lastStep.next;\n while (_step && _step !== step) {\n if (_step.customAnimate) {\n _step.customAnimate.onStart && _step.customAnimate.onStart();\n _step.customAnimate.onEnd && _step.customAnimate.onEnd();\n }\n _step = _step.next;\n }\n // 执行lastStep的onEnd和currentStep的onStart\n if (lastStep && lastStep.customAnimate) {\n lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd();\n }\n if (step && step.customAnimate) {\n step.customAnimate.onStart && step.customAnimate.onStart();\n }\n }\n }\n\n /**\n * 获取这个属性的上一个值\n * @param name\n * @param step\n * @returns\n */\n getLastPropByName(name: string, step: Step): any {\n let lastStep = step.prev;\n while (lastStep) {\n if (lastStep.props && lastStep.props[name] !== undefined) {\n return lastStep.props[name];\n } else if (lastStep.customAnimate) {\n const val = lastStep.customAnimate.getEndProps()[name];\n if (val !== undefined) {\n return val;\n }\n }\n lastStep = lastStep.prev;\n }\n\n Logger.getInstance().warn('未知错误,step中找不到属性');\n return step.props[name];\n }\n\n protected updateTarget(step: Step, ratio: number, end: boolean) {\n if (step.props == null && step.customAnimate == null) {\n return;\n }\n this.target.onStep(this, this.animate, step, ratio, end);\n }\n}\n\n// export class Animate implements IAnimate {\n// declare target: IAnimateTarget;\n// declare timeline: ITimeline;\n// protected declare stepHead: Step;\n// protected declare stepTail: Step;\n// declare nextAnimate?: Animate;\n// declare prevAnimate?: Animate;\n// // 结束时反转动画\n// declare bounce: boolean;\n// // 是否reverse\n// declare reversed: boolean;\n// // 循环次数,0为执行一次,1为执行两次,Infinity为无限循环\n// declare loop: number;\n// // 持续时间,不包括循环\n// declare duration: number;\n// // 当前Animate的状态,正常,暂停,结束\n// declare status: AnimateStatus;\n// // 位置,在[0, duration]之间\n// declare position: number;\n// // 绝对的位置,在[0, loops * duration]之间\n// declare rawPosition: number;\n// // 开始时间\n// protected declare _startAt: number;\n// // 时间的缩放,例如2表示2倍速\n// declare timeScale: number;\n// declare props: Record<string, any>;\n// declare readonly id: string | number;\n\n// protected declare _onStart?: (() => void)[];\n// protected declare _onFrame?: ((step: IStep, ratio: number) => void)[];\n// protected declare _onEnd?: (() => void)[];\n// declare _onRemove?: (() => void)[];\n// declare _preventAttrs?: Set<string>;\n\n// constructor(id: string | number = Generator.GenAutoIncrementId(), timeline: ITimeline = defaultTimeline) {\n// this.timeline = timeline;\n// this.status = AnimateStatus.INITIAL;\n// this.rawPosition = -1;\n// this.position = 0;\n// this.loop = 0;\n// this.timeline.addAnimate(this);\n// this.timeScale = 1;\n// this.id = id;\n// this.props = {};\n// this.stepHead = new Step(0, 0, {});\n// this.stepTail = this.stepHead;\n// }\n\n// preventAttr(key: string) {\n// if (!this._preventAttrs) {\n// this._preventAttrs = new Set();\n// }\n// this._preventAttrs.add(key);\n// }\n// preventAttrs(keys: string[]) {\n// keys.forEach(key => this.preventAttr(key));\n// }\n// validAttr(key: string): boolean {\n// if (!this._preventAttrs) {\n// return true;\n// }\n// return !this._preventAttrs.has(key);\n// }\n\n// getLastPropByName(name: string, step: Step): any {\n// let lastStep = step.prev;\n// while (lastStep) {\n// if (lastStep.props && lastStep.props[name] !== undefined) {\n// return lastStep.props[name];\n// }\n// lastStep = lastStep.prev;\n// }\n// let val = this.props[name];\n// if (!val) {\n// console.warn('未知错误,step中找不到属性');\n// val = this.target.getComputedAttribute(name);\n// this.props[name] = val;\n// }\n\n// return val;\n// }\n\n// bind(target: IAnimateTarget) {\n// this.target = target;\n// this.duration = 0;\n// return this;\n// }\n\n// startAt(t: number) {\n// if (t < 0) {\n// return this;\n// }\n// this._startAt = t;\n// return this;\n// }\n\n// to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n// if (duration == null || duration < 0) {\n// duration = 0;\n// }\n\n// const easingFunc = typeof easing === 'string' ? Easing[easing] : easing;\n\n// const step = this._addStep(duration, null, easingFunc);\n// this._appendProps(props, step, params ? params.tempProps : false);\n// return this;\n// }\n\n// wait(duration: number) {\n// if (duration > 0) {\n// const step = this._addStep(+duration, null);\n// if (step.prev) {\n// step.props = step.prev.props;\n// }\n// if (this.target.onAddStep) {\n// this.target.onAddStep(step);\n// }\n// }\n// return this;\n// }\n\n// protected _addStep(duration: number, props: any, easingFunc?: EasingTypeFunc) {\n// const step = new Step(this.duration, duration, props, easingFunc);\n// this.duration += duration;\n// this.stepTail.append(step);\n// this.stepTail = step;\n// return step;\n// }\n\n// protected _appendProps(props: any, step: Step, tempProps?: boolean) {\n// if (tempProps) {\n// step.props = props;\n// } else {\n// // todo: 是否需要深拷贝props\n// step.props = Object.assign({}, props);\n// }\n// let lastStep = step.prev;\n// const _props = step.props;\n// // 拷贝之前的step阶段属性\n// while (lastStep.prev) {\n// if (lastStep.props) {\n// if (!lastStep.propKeys) {\n// lastStep.propKeys = Object.keys(lastStep.props);\n// }\n// lastStep.propKeys.forEach(key => {\n// if (_props[key] === undefined) {\n// _props[key] = lastStep.props[key];\n// }\n// });\n// }\n// lastStep = lastStep.prev;\n// }\n\n// // 设置最初的props属性\n// const initProps = this.stepHead.props;\n// if (!step.propKeys) {\n// step.propKeys = Object.keys(_props);\n// step.propKeys.forEach(key => {\n// initProps[key] = this.target.getComputedAttribute(key);\n// });\n// }\n\n// if (this.target.onAddStep) {\n// this.target.onAddStep(step);\n// }\n// }\n\n// advance(delta: number) {\n// if (this.status === AnimateStatus.INITIAL) {\n// this.status = AnimateStatus.RUNNING;\n// this._onStart && this._onStart.forEach(cb => cb());\n// }\n// const end = this.setPosition(this.rawPosition + delta * this.timeScale);\n// if (end && this.status === AnimateStatus.RUNNING) {\n// this.status = AnimateStatus.END;\n// this._onEnd && this._onEnd.forEach(cb => cb());\n// }\n// }\n\n// setPosition(rawPosition: number) {\n// const d = this.duration;\n// const loopCount = this.loop;\n// const prevRawPos = this.rawPosition;\n// let end = false;\n// let loop: number; // 当前是第几次循环\n// let position: number; // 当前周期的时间\n// const startAt = this._startAt ?? 0;\n\n// if (rawPosition < 0) {\n// rawPosition = 0;\n// }\n// if (rawPosition < startAt) {\n// this.rawPosition = rawPosition;\n// return false;\n// }\n// rawPosition = rawPosition - startAt;\n// if (d <= 0) {\n// // 如果不用执行,跳过\n// end = true;\n// return end;\n// }\n// loop = Math.floor(rawPosition / d);\n// position = rawPosition - loop * d;\n\n// // 计算rawPosition\n// end = rawPosition >= loopCount * d + d;\n// // 如果结束,跳过\n// if (end) {\n// position = d;\n// loop = loopCount;\n// rawPosition = position * loop + d;\n// }\n\n// if (rawPosition === prevRawPos) {\n// return end;\n// }\n\n// // reverse动画\n// const rev = !this.reversed !== !(this.bounce && loop % 2);\n// if (rev) {\n// position = d - position;\n// }\n\n// this.position = position;\n// this.rawPosition = rawPosition + startAt;\n\n// this.updatePosition(end);\n\n// return end;\n// }\n\n// protected updatePosition(end: boolean) {\n// if (!this.stepHead) {\n// return;\n// }\n// let step = this.stepHead;\n// const position = this.position;\n// const duration = this.duration;\n// if (this.target && step) {\n// let stepNext = step.next;\n// while (stepNext && stepNext.position <= position) {\n// step = step.next;\n// stepNext = step.next;\n// }\n// let ratio = end ? (duration === 0 ? 1 : position / duration) : (position - step.position) / step.duration; // TODO: revisit this.\n// if (step.easing) {\n// ratio = step.easing(ratio);\n// }\n// this.updateTarget(step, ratio, end);\n// this._onFrame && this._onFrame.forEach(cb => cb(step, ratio));\n// }\n// }\n\n// protected updateTarget(step: Step, ratio: number, end: boolean) {\n// if (step.props == null) {\n// return;\n// }\n// this.target.onStep(this, step, ratio, end);\n// }\n\n// onStart(cb: () => void) {\n// if (!this._onStart) {\n// this._onStart = [];\n// }\n// this._onStart.push(cb);\n// }\n// onEnd(cb: () => void) {\n// if (!this._onEnd) {\n// this._onEnd = [];\n// }\n// this._onEnd.push(cb);\n// }\n// onRemove(cb: () => void) {\n// if (!this._onRemove) {\n// this._onRemove = [];\n// }\n// this._onRemove.push(cb);\n// }\n// onFrame(cb: (step: IStep, ratio: number) => void) {\n// if (!this._onFrame) {\n// this._onFrame = [];\n// }\n// this._onFrame.push(cb);\n// }\n\n// getStartProps() {\n// return this.stepHead?.props;\n// }\n\n// getEndProps(target: Record<string, any> = {}) {\n// let step = this.stepHead;\n// while (step) {\n// if (step.props) {\n// Object.assign(target, step.props);\n// }\n// step = step.next;\n// }\n\n// return target;\n// }\n\n// stop(nextVal?: 'start' | 'end' | Record<string, any>) {\n// this.status = AnimateStatus.END;\n// if (!nextVal) {\n// this.target.onStop();\n// }\n// if (nextVal === 'start') {\n// this.target.onStop(this.getStartProps());\n// } else if (nextVal === 'end') {\n// this.target.onStop(this.getEndProps());\n// } else {\n// this.target.onStop(nextVal);\n// }\n// }\n\n// release() {\n// this.status = AnimateStatus.END;\n// return;\n// }\n// }\n\nclass Step implements IStep {\n declare prev?: Step;\n // 持续时间\n declare duration: number;\n // 在animate中的位置\n declare position: number;\n declare next?: Step;\n declare props: any;\n // 保存解析后的props,用于性能优化\n declare parsedProps?: any;\n declare propKeys?: string[];\n declare easing?: EasingTypeFunc;\n declare customAnimate?: ICustomAnimate;\n // passive: boolean;\n // index: number;\n type: IAnimateStepType;\n\n constructor(position: number, duration: number, props?: any, easing?: EasingTypeFunc) {\n this.duration = duration;\n this.position = position;\n this.props = props;\n this.easing = easing;\n }\n\n append(step: Step) {\n step.prev = this;\n step.next = this.next;\n this.next = step;\n }\n\n getLastProps() {\n let step = this.prev;\n while (step) {\n if (step.props) {\n return step.props;\n } else if (step.customAnimate) {\n return step.customAnimate.getMergedEndProps();\n }\n step = step.prev as any;\n }\n return null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/animate/animate.ts"],"names":[],"mappings":";;;AAaA,2CAAmG;AACnG,qCAAkC;AAClC,6CAA+C;AAC/C,yCAA6C;AAC7C,mDAAgD;AA2BhD,MA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AK,CAAC;aACnB;iBAAM,IAAI,IAAI,CAAC,aAAa,EAAE;gBAC7B,OAAO,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,CAAC;aAC/C;YACD,IAAI,GAAG,IAAI,CAAC,IAAW,CAAC;SACzB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"animate.js","sourcesContent":["import type {\n EasingType,\n EasingTypeFunc,\n IAnimate,\n IAnimateStepType,\n IAnimateTarget,\n ICustomAnimate,\n IGraphic,\n IStep,\n IStepConfig,\n ISubAnimate,\n ITimeline\n} from '../interface';\nimport { AnimateMode, AnimateStatus, AnimateStepType, AttributeUpdateType } from '../common/enums';\nimport { Easing } from './easing';\nimport { Logger, max } from '@visactor/vutils';\nimport { defaultTimeline } from './timeline';\nimport { Generator } from '../common/generator';\n\n// 参考TweenJS\n// https://github.com/CreateJS/TweenJS/tree/master/src/tweenjs\n/**\n * The MIT License (MIT)\n\n Copyright (c) 2014 gskinner.com, inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\nexport abstract class ACustomAnimate<T> implements ICustomAnimate {\n declare from: T;\n declare to: T;\n declare duration: number;\n declare easing: EasingType;\n declare params: any;\n declare target: IAnimateTarget;\n declare updateCount: number;\n declare subAnimate: ISubAnimate;\n declare step?: IStep;\n declare mode?: AnimateMode;\n\n // 用于判断是否一致\n declare _endProps?: any;\n declare _mergedEndProps?: any;\n\n constructor(from: T, to: T, duration: number, easing: EasingType, params?: any) {\n this.from = from;\n this.to = to;\n this.duration = duration;\n this.easing = easing;\n this.params = params;\n this.updateCount = 0;\n }\n\n bind(target: IAnimateTarget, subAni: ISubAnimate) {\n this.target = target;\n this.subAnimate = subAni;\n this.onBind();\n }\n\n // 在第一次调用的时候触发\n onBind() {\n return;\n }\n\n // 第一次执行的时候调用\n onFirstRun() {\n return;\n }\n\n // 开始执行的时候调用(如果有循环,那每个周期都会调用)\n onStart() {\n return;\n }\n\n // 结束执行的时候调用(如果有循环,那每个周期都会调用)\n onEnd() {\n return;\n }\n\n getEndProps(): Record<string, any> | void {\n return this.to;\n }\n\n getFromProps(): Record<string, any> | void {\n return this.from;\n }\n\n getMergedEndProps(): Record<string, any> | void {\n const thisEndProps = this.getEndProps();\n if (thisEndProps) {\n if (this._endProps === thisEndProps) {\n return this._mergedEndProps;\n }\n this._endProps = thisEndProps;\n this._mergedEndProps = Object.assign({}, this.step.prev.getLastProps() ?? {}, thisEndProps);\n return;\n }\n return this.step.prev ? this.step.prev.getLastProps() : thisEndProps;\n }\n\n // abstract getFromValue(key: string): any;\n // abstract getToValue(key: string): any;\n\n abstract onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this.updateCount === 0) {\n this.onFirstRun();\n // out添加之前的props\n const props = this.step.getLastProps();\n Object.keys(props).forEach(k => {\n if (this.subAnimate.animate.validAttr(k)) {\n out[k] = props[k];\n }\n });\n }\n this.updateCount += 1;\n this.onUpdate(end, ratio, out);\n if (end) {\n this.onEnd();\n }\n }\n}\n\nexport class CbAnimate extends ACustomAnimate<null> {\n cb: () => void;\n\n constructor(cb: () => void) {\n super(null, null, 0, 'linear');\n this.cb = cb;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n return;\n }\n\n onStart(): void {\n this.cb();\n }\n}\n\ntype InterpolateFunc = (\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IAnimateTarget,\n out: Record<string, any>\n) => boolean;\n\nexport class Animate implements IAnimate {\n static mode: AnimateMode = AnimateMode.NORMAL;\n declare target: IAnimateTarget;\n declare timeline: ITimeline;\n declare nextAnimate?: IAnimate;\n declare prevAnimate?: IAnimate;\n // 当前Animate的状态,正常,暂停,结束\n declare status: AnimateStatus;\n declare readonly id: string | number;\n // 开始时间\n protected declare _startTime: number;\n protected declare _duringTime: number;\n declare subAnimates: SubAnimate[];\n declare tailAnimate: SubAnimate;\n\n // 绝对的位置\n declare rawPosition: number;\n // 时间倍速缩放\n declare timeScale: number;\n\n declare interpolateFunc: (key: string, ratio: number, from: any, to: any, nextAttributes: any) => boolean;\n\n declare _onStart?: (() => void)[];\n declare _onFrame?: ((step: IStep, ratio: number) => void)[];\n declare _onEnd?: (() => void)[];\n declare _onRemove?: (() => void)[];\n declare _preventAttrs?: Set<string>;\n static interpolateMap: Map<string, InterpolateFunc> = new Map();\n slience?: boolean;\n\n constructor(\n id: string | number = Generator.GenAutoIncrementId(),\n timeline: ITimeline = defaultTimeline,\n slience?: boolean\n ) {\n this.id = id;\n this.timeline = timeline || defaultTimeline;\n this.status = AnimateStatus.INITIAL;\n this.tailAnimate = new SubAnimate(this);\n this.subAnimates = [this.tailAnimate];\n this.timeScale = 1;\n this.rawPosition = -1;\n this._startTime = 0;\n this._duringTime = 0;\n this.timeline.addAnimate(this);\n this.slience = slience;\n }\n\n setTimeline(timeline: ITimeline) {\n if (timeline === this.timeline) {\n return;\n }\n this.timeline.removeAnimate(this, false);\n timeline.addAnimate(this);\n }\n\n getStartTime(): number {\n return this._startTime;\n }\n\n getDuration(): number {\n return this.subAnimates.reduce((t, subAnimate) => t + subAnimate.totalDuration, 0);\n }\n\n after(animate: IAnimate) {\n const t = animate.getDuration();\n this._startTime = t;\n return this;\n }\n\n afterAll(list: IAnimate[]) {\n let maxT = -Infinity;\n list.forEach(a => {\n maxT = max(a.getDuration(), maxT);\n });\n this._startTime = maxT;\n return this;\n }\n\n parallel(animate: IAnimate) {\n this._startTime = animate.getStartTime();\n return this;\n }\n\n static AddInterpolate(name: string, cb: InterpolateFunc) {\n Animate.interpolateMap.set(name, cb);\n }\n\n play(customAnimate: ICustomAnimate) {\n this.tailAnimate.play(customAnimate);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n if (this.subAnimates.length === 1 && this.tailAnimate.totalDuration === customAnimate.duration) {\n this.trySetAttribute(customAnimate.getFromProps(), customAnimate.mode);\n }\n return this;\n }\n\n trySetAttribute(attr: Record<string, any> | void, mode: AnimateMode = Animate.mode) {\n if (attr && mode & AnimateMode.SET_ATTR_IMMEDIATELY) {\n (this.target as any).setAttributes &&\n (this.target as any).setAttributes(attr, false, { type: AttributeUpdateType.ANIMATE_PLAY });\n }\n }\n\n runCb(cb: (a: IAnimate, step: IStep) => void) {\n // this.tailAnimate.runCb(cb);\n const customAnimate = new CbAnimate(() => {\n cb(this, customAnimate.step.prev);\n });\n this.tailAnimate.play(customAnimate);\n return this;\n }\n\n /**\n * 自定义插值,返回false表示没有匹配上\n * @param key\n * @param from\n * @param to\n */\n customInterpolate(\n key: string,\n ratio: number,\n from: any,\n to: any,\n target: IAnimateTarget,\n ret: Record<string, any>\n ): boolean {\n const func = Animate.interpolateMap.get(key) || Animate.interpolateMap.get('');\n if (!func) {\n return false;\n }\n return func(key, ratio, from, to, target, ret);\n }\n\n pause() {\n if (this.status === AnimateStatus.RUNNING) {\n this.status = AnimateStatus.PAUSED;\n }\n }\n\n resume() {\n if (this.status === AnimateStatus.PAUSED) {\n this.status = AnimateStatus.RUNNING;\n }\n }\n\n to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n this.tailAnimate.to(props, duration, easing, params);\n // 默认开始动画\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n // if (this.subAnimates.length === 1 && this.tailAnimate.duration === duration) {\n // this.trySetAttribute(props);\n // }\n return this;\n }\n from(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n this.tailAnimate.from(props, duration, easing, params);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n wait(duration: number) {\n this.tailAnimate.wait(duration);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n startAt(t: number) {\n this.tailAnimate.startAt(t);\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n loop(l: number) {\n this.tailAnimate.loop = l;\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n reversed(r: boolean) {\n this.tailAnimate.reversed = r;\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n bounce(b: boolean) {\n this.tailAnimate.bounce = b;\n // todo: 考虑使用绑定的ticker执行\n if (this.target) {\n const stage = (this.target as IGraphic).stage;\n stage && stage.renderNextFrame();\n }\n return this;\n }\n\n subAnimate() {\n const sa = new SubAnimate(this, this.tailAnimate);\n this.tailAnimate = sa;\n this.subAnimates.push(sa);\n sa.bind(this.target);\n return this;\n }\n\n getStartProps(): Record<string, any> {\n return this.subAnimates[0].getStartProps();\n }\n\n getEndProps(): Record<string, any> {\n return this.tailAnimate.getEndProps();\n }\n\n depreventAttr(key: string) {\n if (!this._preventAttrs) {\n return;\n }\n this._preventAttrs.delete(key);\n }\n preventAttr(key: string) {\n if (!this._preventAttrs) {\n this._preventAttrs = new Set();\n }\n this._preventAttrs.add(key);\n }\n preventAttrs(keys: string[]) {\n keys.forEach(key => this.preventAttr(key));\n }\n validAttr(key: string): boolean {\n if (!this._preventAttrs) {\n return true;\n }\n return !this._preventAttrs.has(key);\n }\n\n bind(target: IAnimateTarget) {\n this.target = target;\n\n if (this.target.onAnimateBind && !this.slience) {\n this.target.onAnimateBind(this);\n }\n\n this.subAnimates.forEach(sa => {\n sa.bind(target);\n });\n return this;\n }\n\n advance(delta: number) {\n // startTime之前的时间不计入耗时\n if (this._duringTime < this._startTime) {\n if (this._duringTime + delta * this.timeScale < this._startTime) {\n this._duringTime += delta * this.timeScale;\n return;\n }\n delta = this._duringTime + delta * this.timeScale - this._startTime;\n this._duringTime = this._startTime;\n }\n // 执行advance\n if (this.status === AnimateStatus.INITIAL) {\n this.status = AnimateStatus.RUNNING;\n this._onStart && this._onStart.forEach(cb => cb());\n }\n const end = this.setPosition(Math.max(this.rawPosition, 0) + delta * this.timeScale);\n if (end && this.status === AnimateStatus.RUNNING) {\n this.status = AnimateStatus.END;\n this._onEnd && this._onEnd.forEach(cb => cb());\n }\n }\n\n setPosition(rawPosition: number): boolean {\n let d = 0;\n let sa: SubAnimate | undefined;\n const prevRawPos = this.rawPosition;\n const maxRawPos = this.subAnimates.reduce((a, b) => a + b.totalDuration, 0);\n\n if (rawPosition < 0) {\n rawPosition = 0;\n }\n\n const end = rawPosition >= maxRawPos;\n\n if (end) {\n rawPosition = maxRawPos;\n }\n\n if (rawPosition === prevRawPos) {\n return end;\n }\n\n // 查找对应的subAnimate\n for (let i = 0; i < this.subAnimates.length; i++) {\n sa = this.subAnimates[i];\n if (d + sa.totalDuration >= rawPosition) {\n break;\n } else {\n d += sa.totalDuration;\n sa = undefined;\n }\n }\n this.rawPosition = rawPosition;\n sa.setPosition(rawPosition - d);\n\n return end;\n }\n\n onStart(cb: () => void) {\n if (!this._onStart) {\n this._onStart = [];\n }\n this._onStart.push(cb);\n }\n onEnd(cb: () => void) {\n if (!this._onEnd) {\n this._onEnd = [];\n }\n this._onEnd.push(cb);\n }\n onRemove(cb: () => void) {\n if (!this._onRemove) {\n this._onRemove = [];\n }\n this._onRemove.push(cb);\n }\n onFrame(cb: (step: IStep, ratio: number) => void) {\n if (!this._onFrame) {\n this._onFrame = [];\n }\n this._onFrame.push(cb);\n }\n release() {\n this.status = AnimateStatus.END;\n return;\n }\n\n stop(nextVal?: 'start' | 'end' | Record<string, any>) {\n if (!nextVal) {\n this.target.onStop();\n }\n if (nextVal === 'start') {\n this.target.onStop(this.getStartProps());\n } else if (nextVal === 'end') {\n this.target.onStop(this.getEndProps());\n } else {\n this.target.onStop(nextVal);\n }\n this.release();\n }\n}\n\n// Animate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nexport class SubAnimate implements ISubAnimate {\n declare target: IAnimateTarget;\n declare animate: IAnimate;\n // 默认的初始step,一定存在,且stepHead的props一定保存整个subAnimate阶段所有属性的最初\n protected declare stepHead: Step;\n protected declare stepTail: Step;\n // 结束时反转动画\n declare bounce: boolean;\n // 是否reverse\n declare reversed: boolean;\n // 循环次数,0为执行一次,1为执行两次,Infinity为无限循环\n declare loop: number;\n // 持续时间,不包括循环\n declare duration: number;\n // 位置,在[0, duration]之间\n declare position: number;\n // 绝对的位置,在[0, loops * duration]之间\n declare rawPosition: number;\n declare dirty: boolean;\n\n declare _totalDuration: number;\n declare _startAt: number;\n declare _lastStep: IStep;\n declare _deltaPosition: number;\n\n get totalDuration(): number {\n this.calcAttr();\n return this._totalDuration + this._startAt;\n }\n\n constructor(animate: IAnimate, lastSubAnimate?: SubAnimate) {\n this.rawPosition = -1;\n this.position = 0;\n this.loop = 0;\n this.duration = 0;\n this.animate = animate;\n if (lastSubAnimate) {\n this.stepHead = new Step(0, 0, Object.assign({}, lastSubAnimate.stepTail.props));\n } else {\n this.stepHead = new Step(0, 0, {});\n }\n this.stepTail = this.stepHead;\n this.dirty = true;\n this._startAt = 0;\n }\n\n // 计算按需计算的属性\n protected calcAttr() {\n if (!this.dirty) {\n return;\n }\n\n this._totalDuration = this.duration * (this.loop + 1);\n }\n\n bind(target: IAnimateTarget) {\n this.target = target;\n return this;\n }\n\n play(customAnimate: ICustomAnimate) {\n let duration = customAnimate.duration;\n if (duration == null || duration < 0) {\n duration = 0;\n }\n const easing = customAnimate.easing;\n const easingFunc = typeof easing === 'string' ? Easing[easing] : easing;\n const step = this._addStep(duration, null, easingFunc);\n step.type = AnimateStepType.customAnimate;\n this._appendProps(customAnimate.getEndProps(), step, false);\n this._appendCustomAnimate(customAnimate, step);\n return this;\n }\n\n // _appendPlayProps(step: IStep) {\n\n // return;\n // }\n\n to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n if (duration == null || duration < 0) {\n duration = 0;\n }\n\n const easingFunc = typeof easing === 'string' ? Easing[easing] : easing;\n\n const step = this._addStep(duration, null, easingFunc);\n step.type = AnimateStepType.to;\n this._appendProps(props, step, params ? params.tempProps : false);\n // this._appendPlayProps(step);\n\n if (!step.propKeys) {\n step.propKeys = Object.keys(step.props);\n }\n if (!(params && params.noPreventAttrs)) {\n this.target.animates.forEach(a => {\n if (a.id !== this.animate.id) {\n a.preventAttrs(step.propKeys);\n }\n });\n }\n return this;\n }\n\n from(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n this.to(props, 0, easing, params);\n const toProps = {};\n if (!this.stepTail.propKeys) {\n this.stepTail.propKeys = Object.keys(this.stepTail.props);\n }\n this.stepTail.propKeys.forEach(k => {\n toProps[k] = this.getLastPropByName(k, this.stepTail);\n });\n this.to(toProps, duration, easing, params);\n this.stepTail.type = AnimateStepType.from;\n }\n\n startAt(t: number) {\n if (t < 0) {\n t = 0;\n }\n this._startAt = t;\n return this;\n }\n\n getStartProps() {\n return this.stepHead?.props;\n }\n\n getEndProps() {\n return this.stepTail.props;\n }\n\n getLastStep() {\n return this._lastStep;\n }\n\n wait(duration: number) {\n if (duration > 0) {\n const step = this._addStep(+duration, null);\n\n step.type = AnimateStepType.wait;\n // TODO 这里如果跳帧的话会存在bug\n if (step.prev.customAnimate) {\n step.props = step.prev.customAnimate.getEndProps();\n } else {\n step.props = step.prev.props;\n }\n if (this.target.onAddStep) {\n this.target.onAddStep(step);\n }\n // this._appendPlayProps(step);\n }\n return this;\n }\n\n protected _addStep(duration: number, props: any, easingFunc?: EasingTypeFunc) {\n const step = new Step(this.duration, duration, props, easingFunc);\n this.duration += duration;\n this.stepTail.append(step);\n this.stepTail = step;\n return step;\n }\n\n protected _appendProps(props: any, step: Step, tempProps?: boolean) {\n if (tempProps) {\n step.props = props;\n } else {\n // todo: 是否需要深拷贝props\n step.props = Object.assign({}, props);\n }\n let lastStep = step.prev;\n const _props = step.props;\n // 将undefined的属性设置到默认值\n if (!step.propKeys) {\n step.propKeys = Object.keys(step.props);\n }\n step.propKeys.forEach(k => {\n if (step.props[k] === undefined) {\n step.props[k] = this.target.getDefaultAttribute(k);\n }\n });\n // 拷贝之前的step阶段属性\n while (lastStep.prev) {\n if (lastStep.props) {\n if (!lastStep.propKeys) {\n lastStep.propKeys = Object.keys(lastStep.props);\n }\n lastStep.propKeys.forEach(key => {\n if (_props[key] === undefined) {\n _props[key] = lastStep.props[key];\n }\n });\n }\n // 重置propKeys\n step.propKeys = Object.keys(step.props);\n lastStep = lastStep.prev;\n }\n\n // 设置最初的props属性\n const initProps = this.stepHead.props;\n if (!step.propKeys) {\n step.propKeys = Object.keys(_props);\n }\n step.propKeys.forEach(key => {\n if (initProps[key] === undefined) {\n const parentAnimateInitProps = this.animate.getStartProps();\n initProps[key] = parentAnimateInitProps[key] = this.target.getComputedAttribute(key);\n }\n });\n\n if (this.target.onAddStep) {\n this.target.onAddStep(step);\n }\n }\n\n protected _appendCustomAnimate(customAnimate: ICustomAnimate, step: Step) {\n step.customAnimate = customAnimate;\n customAnimate.step = step;\n customAnimate.bind(this.target, this);\n }\n\n setPosition(rawPosition: number) {\n const d = this.duration;\n const loopCount = this.loop;\n const prevRawPos = this.rawPosition;\n let end = false;\n let loop: number; // 当前是第几次循环\n let position: number; // 当前周期的时间\n const startAt = this._startAt ?? 0;\n\n if (rawPosition < 0) {\n rawPosition = 0;\n }\n if (rawPosition < startAt) {\n this.rawPosition = rawPosition;\n return false;\n }\n rawPosition = rawPosition - startAt;\n if (d <= 0) {\n // 如果不用执行,跳过\n end = true;\n // 小于0的话,直接return,如果等于0,那还是得走动画逻辑,将end属性设置上去\n if (d < 0) {\n return end;\n }\n }\n loop = Math.floor(rawPosition / d);\n position = rawPosition - loop * d;\n\n // 计算rawPosition\n end = rawPosition >= loopCount * d + d;\n // 如果结束,跳过\n if (end) {\n position = d;\n loop = loopCount;\n rawPosition = position * loop + d;\n }\n\n if (rawPosition === prevRawPos) {\n return end;\n }\n\n // reverse动画\n const rev = !this.reversed !== !(this.bounce && loop % 2);\n if (rev) {\n position = d - position;\n }\n\n this._deltaPosition = position - this.position;\n this.position = position;\n this.rawPosition = rawPosition + startAt;\n\n this.updatePosition(end, rev);\n\n return end;\n }\n\n protected updatePosition(end: boolean, rev: boolean) {\n if (!this.stepHead) {\n return;\n }\n let step = this.stepHead.next;\n const position = this.position;\n const duration = this.duration;\n if (this.target && step) {\n let stepNext = step.next;\n while (stepNext && stepNext.position <= position) {\n step = stepNext;\n stepNext = step.next;\n }\n let ratio = end ? (duration === 0 ? 1 : position / duration) : (position - step.position) / step.duration; // TODO: revisit this.\n if (step.easing) {\n ratio = step.easing(ratio);\n }\n // 判断这次和上次过程中是否经历了自定义step,如果跳过了自定义step那么执行自定义step的onEnd\n this.tryCallCustomAnimateLifeCycle(step, this._lastStep || (rev ? this.stepTail : this.stepHead), rev);\n // if (step !== this._lastStep) {\n // if (this._deltaPosition > 0) {\n // let _step = step.prev;\n // while (_step && _step !== this._lastStep) {\n // if (_step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // _step = _step.prev;\n // }\n // if (_step && _step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // } else if (this._deltaPosition < 0) {\n // let _step = step.next;\n // while (_step && _step !== this._lastStep) {\n // if (_step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // _step = _step.next;\n // }\n // if (_step && _step.customAnimate) {\n // _step.customAnimate.onEnd();\n // }\n // }\n // }\n this.updateTarget(step, ratio, end);\n this._lastStep = step;\n\n this.animate._onFrame && this.animate._onFrame.forEach(cb => cb(step, ratio));\n }\n }\n\n // 如果动画卡顿跳过了自定义动画,那么尝试执行自定义动画的生命周期\n tryCallCustomAnimateLifeCycle(step: IStep, lastStep: IStep, rev: boolean) {\n if (step === lastStep) {\n return;\n }\n if (rev) {\n let _step = lastStep.prev;\n while (_step && _step !== step) {\n if (_step.customAnimate) {\n _step.customAnimate.onStart && _step.customAnimate.onStart();\n _step.customAnimate.onEnd && _step.customAnimate.onEnd();\n }\n _step = step.prev;\n }\n // 执行lastStep的onEnd和currentStep的onStart\n if (lastStep && lastStep.customAnimate) {\n lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd();\n }\n if (step && step.customAnimate) {\n step.customAnimate.onStart && step.customAnimate.onStart();\n }\n } else {\n let _step = lastStep.next;\n while (_step && _step !== step) {\n if (_step.customAnimate) {\n _step.customAnimate.onStart && _step.customAnimate.onStart();\n _step.customAnimate.onEnd && _step.customAnimate.onEnd();\n }\n _step = _step.next;\n }\n // 执行lastStep的onEnd和currentStep的onStart\n if (lastStep && lastStep.customAnimate) {\n lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd();\n }\n if (step && step.customAnimate) {\n step.customAnimate.onStart && step.customAnimate.onStart();\n }\n }\n }\n\n /**\n * 获取这个属性的上一个值\n * @param name\n * @param step\n * @returns\n */\n getLastPropByName(name: string, step: Step): any {\n let lastStep = step.prev;\n while (lastStep) {\n if (lastStep.props && lastStep.props[name] !== undefined) {\n return lastStep.props[name];\n } else if (lastStep.customAnimate) {\n const val = lastStep.customAnimate.getEndProps()[name];\n if (val !== undefined) {\n return val;\n }\n }\n lastStep = lastStep.prev;\n }\n\n Logger.getInstance().warn('未知错误,step中找不到属性');\n return step.props[name];\n }\n\n protected updateTarget(step: Step, ratio: number, end: boolean) {\n if (step.props == null && step.customAnimate == null) {\n return;\n }\n this.target.onStep(this, this.animate, step, ratio, end);\n }\n}\n\n// export class Animate implements IAnimate {\n// declare target: IAnimateTarget;\n// declare timeline: ITimeline;\n// protected declare stepHead: Step;\n// protected declare stepTail: Step;\n// declare nextAnimate?: Animate;\n// declare prevAnimate?: Animate;\n// // 结束时反转动画\n// declare bounce: boolean;\n// // 是否reverse\n// declare reversed: boolean;\n// // 循环次数,0为执行一次,1为执行两次,Infinity为无限循环\n// declare loop: number;\n// // 持续时间,不包括循环\n// declare duration: number;\n// // 当前Animate的状态,正常,暂停,结束\n// declare status: AnimateStatus;\n// // 位置,在[0, duration]之间\n// declare position: number;\n// // 绝对的位置,在[0, loops * duration]之间\n// declare rawPosition: number;\n// // 开始时间\n// protected declare _startAt: number;\n// // 时间的缩放,例如2表示2倍速\n// declare timeScale: number;\n// declare props: Record<string, any>;\n// declare readonly id: string | number;\n\n// protected declare _onStart?: (() => void)[];\n// protected declare _onFrame?: ((step: IStep, ratio: number) => void)[];\n// protected declare _onEnd?: (() => void)[];\n// declare _onRemove?: (() => void)[];\n// declare _preventAttrs?: Set<string>;\n\n// constructor(id: string | number = Generator.GenAutoIncrementId(), timeline: ITimeline = defaultTimeline) {\n// this.timeline = timeline;\n// this.status = AnimateStatus.INITIAL;\n// this.rawPosition = -1;\n// this.position = 0;\n// this.loop = 0;\n// this.timeline.addAnimate(this);\n// this.timeScale = 1;\n// this.id = id;\n// this.props = {};\n// this.stepHead = new Step(0, 0, {});\n// this.stepTail = this.stepHead;\n// }\n\n// preventAttr(key: string) {\n// if (!this._preventAttrs) {\n// this._preventAttrs = new Set();\n// }\n// this._preventAttrs.add(key);\n// }\n// preventAttrs(keys: string[]) {\n// keys.forEach(key => this.preventAttr(key));\n// }\n// validAttr(key: string): boolean {\n// if (!this._preventAttrs) {\n// return true;\n// }\n// return !this._preventAttrs.has(key);\n// }\n\n// getLastPropByName(name: string, step: Step): any {\n// let lastStep = step.prev;\n// while (lastStep) {\n// if (lastStep.props && lastStep.props[name] !== undefined) {\n// return lastStep.props[name];\n// }\n// lastStep = lastStep.prev;\n// }\n// let val = this.props[name];\n// if (!val) {\n// console.warn('未知错误,step中找不到属性');\n// val = this.target.getComputedAttribute(name);\n// this.props[name] = val;\n// }\n\n// return val;\n// }\n\n// bind(target: IAnimateTarget) {\n// this.target = target;\n// this.duration = 0;\n// return this;\n// }\n\n// startAt(t: number) {\n// if (t < 0) {\n// return this;\n// }\n// this._startAt = t;\n// return this;\n// }\n\n// to(props: Record<string, any>, duration: number, easing: EasingType, params?: IStepConfig) {\n// if (duration == null || duration < 0) {\n// duration = 0;\n// }\n\n// const easingFunc = typeof easing === 'string' ? Easing[easing] : easing;\n\n// const step = this._addStep(duration, null, easingFunc);\n// this._appendProps(props, step, params ? params.tempProps : false);\n// return this;\n// }\n\n// wait(duration: number) {\n// if (duration > 0) {\n// const step = this._addStep(+duration, null);\n// if (step.prev) {\n// step.props = step.prev.props;\n// }\n// if (this.target.onAddStep) {\n// this.target.onAddStep(step);\n// }\n// }\n// return this;\n// }\n\n// protected _addStep(duration: number, props: any, easingFunc?: EasingTypeFunc) {\n// const step = new Step(this.duration, duration, props, easingFunc);\n// this.duration += duration;\n// this.stepTail.append(step);\n// this.stepTail = step;\n// return step;\n// }\n\n// protected _appendProps(props: any, step: Step, tempProps?: boolean) {\n// if (tempProps) {\n// step.props = props;\n// } else {\n// // todo: 是否需要深拷贝props\n// step.props = Object.assign({}, props);\n// }\n// let lastStep = step.prev;\n// const _props = step.props;\n// // 拷贝之前的step阶段属性\n// while (lastStep.prev) {\n// if (lastStep.props) {\n// if (!lastStep.propKeys) {\n// lastStep.propKeys = Object.keys(lastStep.props);\n// }\n// lastStep.propKeys.forEach(key => {\n// if (_props[key] === undefined) {\n// _props[key] = lastStep.props[key];\n// }\n// });\n// }\n// lastStep = lastStep.prev;\n// }\n\n// // 设置最初的props属性\n// const initProps = this.stepHead.props;\n// if (!step.propKeys) {\n// step.propKeys = Object.keys(_props);\n// step.propKeys.forEach(key => {\n// initProps[key] = this.target.getComputedAttribute(key);\n// });\n// }\n\n// if (this.target.onAddStep) {\n// this.target.onAddStep(step);\n// }\n// }\n\n// advance(delta: number) {\n// if (this.status === AnimateStatus.INITIAL) {\n// this.status = AnimateStatus.RUNNING;\n// this._onStart && this._onStart.forEach(cb => cb());\n// }\n// const end = this.setPosition(this.rawPosition + delta * this.timeScale);\n// if (end && this.status === AnimateStatus.RUNNING) {\n// this.status = AnimateStatus.END;\n// this._onEnd && this._onEnd.forEach(cb => cb());\n// }\n// }\n\n// setPosition(rawPosition: number) {\n// const d = this.duration;\n// const loopCount = this.loop;\n// const prevRawPos = this.rawPosition;\n// let end = false;\n// let loop: number; // 当前是第几次循环\n// let position: number; // 当前周期的时间\n// const startAt = this._startAt ?? 0;\n\n// if (rawPosition < 0) {\n// rawPosition = 0;\n// }\n// if (rawPosition < startAt) {\n// this.rawPosition = rawPosition;\n// return false;\n// }\n// rawPosition = rawPosition - startAt;\n// if (d <= 0) {\n// // 如果不用执行,跳过\n// end = true;\n// return end;\n// }\n// loop = Math.floor(rawPosition / d);\n// position = rawPosition - loop * d;\n\n// // 计算rawPosition\n// end = rawPosition >= loopCount * d + d;\n// // 如果结束,跳过\n// if (end) {\n// position = d;\n// loop = loopCount;\n// rawPosition = position * loop + d;\n// }\n\n// if (rawPosition === prevRawPos) {\n// return end;\n// }\n\n// // reverse动画\n// const rev = !this.reversed !== !(this.bounce && loop % 2);\n// if (rev) {\n// position = d - position;\n// }\n\n// this.position = position;\n// this.rawPosition = rawPosition + startAt;\n\n// this.updatePosition(end);\n\n// return end;\n// }\n\n// protected updatePosition(end: boolean) {\n// if (!this.stepHead) {\n// return;\n// }\n// let step = this.stepHead;\n// const position = this.position;\n// const duration = this.duration;\n// if (this.target && step) {\n// let stepNext = step.next;\n// while (stepNext && stepNext.position <= position) {\n// step = step.next;\n// stepNext = step.next;\n// }\n// let ratio = end ? (duration === 0 ? 1 : position / duration) : (position - step.position) / step.duration; // TODO: revisit this.\n// if (step.easing) {\n// ratio = step.easing(ratio);\n// }\n// this.updateTarget(step, ratio, end);\n// this._onFrame && this._onFrame.forEach(cb => cb(step, ratio));\n// }\n// }\n\n// protected updateTarget(step: Step, ratio: number, end: boolean) {\n// if (step.props == null) {\n// return;\n// }\n// this.target.onStep(this, step, ratio, end);\n// }\n\n// onStart(cb: () => void) {\n// if (!this._onStart) {\n// this._onStart = [];\n// }\n// this._onStart.push(cb);\n// }\n// onEnd(cb: () => void) {\n// if (!this._onEnd) {\n// this._onEnd = [];\n// }\n// this._onEnd.push(cb);\n// }\n// onRemove(cb: () => void) {\n// if (!this._onRemove) {\n// this._onRemove = [];\n// }\n// this._onRemove.push(cb);\n// }\n// onFrame(cb: (step: IStep, ratio: number) => void) {\n// if (!this._onFrame) {\n// this._onFrame = [];\n// }\n// this._onFrame.push(cb);\n// }\n\n// getStartProps() {\n// return this.stepHead?.props;\n// }\n\n// getEndProps(target: Record<string, any> = {}) {\n// let step = this.stepHead;\n// while (step) {\n// if (step.props) {\n// Object.assign(target, step.props);\n// }\n// step = step.next;\n// }\n\n// return target;\n// }\n\n// stop(nextVal?: 'start' | 'end' | Record<string, any>) {\n// this.status = AnimateStatus.END;\n// if (!nextVal) {\n// this.target.onStop();\n// }\n// if (nextVal === 'start') {\n// this.target.onStop(this.getStartProps());\n// } else if (nextVal === 'end') {\n// this.target.onStop(this.getEndProps());\n// } else {\n// this.target.onStop(nextVal);\n// }\n// }\n\n// release() {\n// this.status = AnimateStatus.END;\n// return;\n// }\n// }\n\nclass Step implements IStep {\n declare prev?: Step;\n // 持续时间\n declare duration: number;\n // 在animate中的位置\n declare position: number;\n declare next?: Step;\n declare props: any;\n // 保存解析后的props,用于性能优化\n declare parsedProps?: any;\n declare propKeys?: string[];\n declare easing?: EasingTypeFunc;\n declare customAnimate?: ICustomAnimate;\n // passive: boolean;\n // index: number;\n type: IAnimateStepType;\n\n constructor(position: number, duration: number, props?: any, easing?: EasingTypeFunc) {\n this.duration = duration;\n this.position = position;\n this.props = props;\n this.easing = easing;\n }\n\n append(step: Step) {\n step.prev = this;\n step.next = this.next;\n this.next = step;\n }\n\n getLastProps() {\n let step = this.prev;\n while (step) {\n if (step.props) {\n return step.props;\n } else if (step.customAnimate) {\n return step.customAnimate.getMergedEndProps();\n }\n step = step.prev as any;\n }\n return null;\n }\n}\n"]}
|
|
@@ -8,44 +8,18 @@ const vutils_1 = require("@visactor/vutils"), enums_1 = require("./enums"), cubi
|
|
|
8
8
|
|
|
9
9
|
function drawAreaSegments(path, segPath, percent, params) {
|
|
10
10
|
var _a;
|
|
11
|
-
const {drawConnect: drawConnect = !1, mode: mode = "none"} = params || {};
|
|
12
|
-
if (drawConnect && "none" === mode) return;
|
|
13
11
|
const {top: top, bottom: bottom} = segPath;
|
|
14
12
|
if (top.curves.length !== bottom.curves.length) return;
|
|
15
13
|
if (percent >= 1) {
|
|
16
14
|
const topList = [], bottomList = [];
|
|
17
15
|
let lastDefined = !0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
let currentTopCurve = curve, currentBottomCurve = bototmCurve;
|
|
24
|
-
if (curve.originP1 === curve.originP2) return lastCurve = curve, void (lastBottomCurve = bototmCurve);
|
|
25
|
-
if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (currentTopCurve = lastCurve,
|
|
26
|
-
currentBottomCurve = lastBottomCurve), curve.defined) defined0 || (topList.push(currentTopCurve),
|
|
27
|
-
bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params),
|
|
28
|
-
topList.length = 0, bottomList.length = 0, defined0 = !defined0); else {
|
|
29
|
-
const {originP1: originP1, originP2: originP2} = curve;
|
|
30
|
-
let validTopCurve, validBottomCurve;
|
|
31
|
-
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = curve,
|
|
32
|
-
validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || curve),
|
|
33
|
-
bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0,
|
|
34
|
-
topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve),
|
|
35
|
-
drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
36
|
-
}
|
|
37
|
-
lastCurve = curve;
|
|
38
|
-
})), drawAreaConnectBlock(path, topList, bottomList, params);
|
|
39
|
-
} else {
|
|
40
|
-
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
41
|
-
const topCurve = top.curves[i];
|
|
42
|
-
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params),
|
|
43
|
-
topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])),
|
|
44
|
-
lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
|
|
45
|
-
}
|
|
46
|
-
drawAreaBlock(path, topList, bottomList, params);
|
|
16
|
+
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
17
|
+
const topCurve = top.curves[i];
|
|
18
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params),
|
|
19
|
+
topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])),
|
|
20
|
+
lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
|
|
47
21
|
}
|
|
48
|
-
return;
|
|
22
|
+
return void drawAreaBlock(path, topList, bottomList, params);
|
|
49
23
|
}
|
|
50
24
|
if (percent <= 0) return;
|
|
51
25
|
let {direction: direction} = params || {};
|
|
@@ -56,54 +30,20 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
56
30
|
const totalDrawLength = percent * (direction === enums_1.Direction.ROW ? xTotalLength : yTotalLength);
|
|
57
31
|
let drawedLengthUntilLast = 0, lastDefined = !0;
|
|
58
32
|
const topList = [], bottomList = [];
|
|
59
|
-
let lastTopCurve, lastBottomCurve, defined0 = !0;
|
|
60
33
|
for (let i = 0, n = top.curves.length; i < n; i++) {
|
|
61
34
|
const topCurve = top.curves[i], curCurveLength = topCurve.getLength(direction), percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
|
|
62
35
|
if (percent < 0) break;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params),
|
|
73
|
-
topList.length = 0, bottomList.length = 0, defined0 = !defined0); else {
|
|
74
|
-
const {originP1: originP1, originP2: originP2} = topCurve;
|
|
75
|
-
let validTopCurve, validBottomCurve;
|
|
76
|
-
originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = topCurve,
|
|
77
|
-
validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || topCurve),
|
|
78
|
-
bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0,
|
|
79
|
-
topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve),
|
|
80
|
-
drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
|
|
81
|
-
}
|
|
82
|
-
lastTopCurve = topCurve;
|
|
83
|
-
} else {
|
|
84
|
-
let tc = null, bc = null;
|
|
85
|
-
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params),
|
|
86
|
-
topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]),
|
|
87
|
-
lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]),
|
|
88
|
-
tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? (0, cubic_bezier_1.divideCubic)(tc, percent)[0] : (0,
|
|
89
|
-
line_1.divideLinear)(tc, percent)[0], bc = bc.p2 && bc.p3 ? (0, cubic_bezier_1.divideCubic)(bc, 1 - percent)[1] : (0,
|
|
90
|
-
line_1.divideLinear)(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined,
|
|
91
|
-
topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
|
|
92
|
-
}
|
|
36
|
+
drawedLengthUntilLast += curCurveLength;
|
|
37
|
+
let tc = null, bc = null;
|
|
38
|
+
lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params),
|
|
39
|
+
topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]),
|
|
40
|
+
lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]),
|
|
41
|
+
tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? (0, cubic_bezier_1.divideCubic)(tc, percent)[0] : (0,
|
|
42
|
+
line_1.divideLinear)(tc, percent)[0], bc = bc.p2 && bc.p3 ? (0, cubic_bezier_1.divideCubic)(bc, 1 - percent)[1] : (0,
|
|
43
|
+
line_1.divideLinear)(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined,
|
|
44
|
+
topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
|
|
93
45
|
}
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function drawAreaConnectBlock(path, topList, bottomList, params) {
|
|
98
|
-
if (topList.length < 2) return;
|
|
99
|
-
const {offsetX: offsetX = 0, offsetY: offsetY = 0, offsetZ: offsetZ = 0, mode: mode} = params || {};
|
|
100
|
-
let curve = topList[0];
|
|
101
|
-
path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = topList[topList.length - 1];
|
|
102
|
-
let end = curve.p3 || curve.p1;
|
|
103
|
-
path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), curve = bottomList[bottomList.length - 1],
|
|
104
|
-
path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = bottomList[0],
|
|
105
|
-
end = curve.p3 || curve.p1, path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ),
|
|
106
|
-
path.closePath();
|
|
46
|
+
drawAreaBlock(path, topList, bottomList, params);
|
|
107
47
|
}
|
|
108
48
|
|
|
109
49
|
function drawAreaBlock(path, topList, bottomList, params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common/render-area.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AAEvC,mCAAoC;AACpC,+DAA2D;AAC3D,+CAAoD;AACpD,iDAA6C;AAW7C,SAAgB,gBAAgB,CAC9B,IAAa,EACb,OAAuB,EACvB,OAAe,EACf,MASC;;IAED,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAC5D,IAAI,WAAW,IAAI,IAAI,KAAK,MAAM,EAAE;QAClC,OAAO;KACR;IAED,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEhC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC9C,OAAO;KACR;IACD,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,MAAM,OAAO,GAAqB,EAAE,CAAC;QACrC,MA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AE,MAAM,CAAC,CAAC;QACpC,UAAU,GAAG,KAAK,CAAC;KACpB;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;AACnB,CAAC","file":"render-area.js","sourcesContent":["import type { IPoint } from '@visactor/vutils';\nimport { abs } from '@visactor/vutils';\nimport type { IAreaCacheItem, ICubicBezierCurve, ICurve, IDirection, ILineCurve, IPath2D } from '../interface';\nimport { Direction } from './enums';\nimport { divideCubic } from './segment/curve/cubic-bezier';\nimport { divideLinear } from './segment/curve/line';\nimport { drawSegItem } from './render-utils';\n\n/**\n * 绘制连续的线段\n * 绘制长度为总长度percent的path,drawDirection为绘制的方向,也就是percent的方向\n * @param path\n * @param segPath\n * @param percent\n * @param drawDirection 绘制的方向,用于使用percent绘制\n * @param line 用于获取line相关属性\n */\nexport function drawAreaSegments(\n path: IPath2D,\n segPath: IAreaCacheItem,\n percent: number,\n params?: {\n offsetX?: number;\n offsetY?: number;\n offsetZ?: number;\n direction?: IDirection;\n drawConnect?: boolean; // 是否是绘制connect区域的效果\n mode?: 'none' | 'connect' | 'zero';\n zeroX?: number;\n zeroY?: number;\n }\n) {\n const { drawConnect = false, mode = 'none' } = params || {};\n if (drawConnect && mode === 'none') {\n return;\n }\n // let needMoveTo: boolean = true;\n const { top, bottom } = segPath;\n // 如果top和bottom的curves数量不同,那么就跳过\n if (top.curves.length !== bottom.curves.length) {\n return;\n }\n if (percent >= 1) {\n const topList: ICurve<IPoint>[] = [];\n const bottomList: ICurve<IPoint>[] = [];\n let lastDefined: boolean = true;\n if (drawConnect) {\n let defined0 = true;\n let lastCurve: ICurve<IPoint>;\n let lastBottomCurve: ICurve<IPoint>;\n const n = top.curves.length;\n top.curves.forEach((curve, i) => {\n // step的逻辑\n const bototmCurve = bottom.curves[n - i - 1];\n let currentTopCurve = curve;\n let currentBottomCurve = bototmCurve;\n if (curve.originP1 === curve.originP2) {\n lastCurve = curve;\n lastBottomCurve = bototmCurve;\n return;\n }\n if (lastCurve && lastCurve.originP1 === lastCurve.originP2) {\n currentTopCurve = lastCurve;\n currentBottomCurve = lastBottomCurve;\n }\n if (curve.defined) {\n // 非法变合法需要lineTo,合法变非法需要moveTo,初始非法需要moveTo\n if (!defined0) {\n topList.push(currentTopCurve);\n bottomList.push(currentBottomCurve);\n drawAreaConnectBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n defined0 = !defined0;\n }\n } else {\n // 找到合法的点\n const { originP1, originP2 } = curve;\n let validTopCurve: ICurve<IPoint>;\n let validBottomCurve: ICurve<IPoint>;\n if (originP1 && originP1.defined !== false) {\n validTopCurve = currentTopCurve;\n validBottomCurve = currentBottomCurve;\n } else if (originP1 && originP2.defined !== false) {\n validTopCurve = curve;\n validBottomCurve = bototmCurve;\n }\n // 合法/(初始)变非法,moveTo\n if (defined0) {\n defined0 = !defined0;\n topList.push(validTopCurve || curve);\n bottomList.push(validBottomCurve || bototmCurve);\n } else {\n // 非法变非法/合法,看情况要不要lineTo\n if (validTopCurve) {\n // 非法变合法,需要lineTo\n defined0 = !defined0;\n topList.push(validTopCurve || curve);\n bottomList.push(validBottomCurve || bototmCurve);\n drawAreaConnectBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n }\n }\n }\n lastCurve = curve;\n });\n drawAreaConnectBlock(path, topList, bottomList, params);\n } else {\n for (let i = 0, n = top.curves.length; i < n; i++) {\n const topCurve = top.curves[i];\n if (lastDefined !== topCurve.defined) {\n if (lastDefined) {\n drawAreaBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n } else {\n topList.push(topCurve);\n bottomList.push(bottom.curves[n - i - 1]);\n }\n lastDefined = !lastDefined;\n } else {\n if (lastDefined) {\n topList.push(topCurve);\n bottomList.push(bottom.curves[n - i - 1]);\n }\n }\n }\n drawAreaBlock(path, topList, bottomList, params);\n }\n\n return;\n }\n if (percent <= 0) {\n return;\n }\n\n let { direction } = params || {};\n const { curves: topCurves } = top;\n const endP = topCurves[topCurves.length - 1].p3 ?? topCurves[topCurves.length - 1].p1;\n const xTotalLength = abs(endP.x - topCurves[0].p0.x);\n const yTotalLength = abs(endP.y - topCurves[0].p0.y);\n direction = direction ?? (xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN);\n if (!Number.isFinite(xTotalLength)) {\n direction = Direction.COLUMN;\n }\n if (!Number.isFinite(yTotalLength)) {\n direction = Direction.ROW;\n }\n\n // x和y必须始终保持同方向\n // 整个线段的总长度(基于水平、垂直方向)\n const totalLength: number = direction === Direction.ROW ? xTotalLength : yTotalLength;\n\n // 总需要绘制的长度\n const totalDrawLength = percent * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let lastDefined: boolean = true;\n const topList: ICurve<IPoint>[] = [];\n const bottomList: ICurve<IPoint>[] = [];\n let defined0 = true;\n let lastTopCurve: ICurve<IPoint>;\n let lastBottomCurve: ICurve<IPoint>;\n for (let i = 0, n = top.curves.length; i < n; i++) {\n const topCurve = top.curves[i];\n const curCurveLength = topCurve.getLength(direction);\n const percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;\n if (percent < 0) {\n break;\n }\n drawedLengthUntilLast += curCurveLength;\n\n if (drawConnect) {\n // step的逻辑\n const bototmCurve = bottom.curves[n - i - 1];\n let currentTopCurve = topCurve;\n let currentBottomCurve = bototmCurve;\n if (topCurve.originP1 === topCurve.originP2) {\n lastTopCurve = topCurve;\n lastBottomCurve = bototmCurve;\n continue;\n }\n if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2) {\n currentTopCurve = lastTopCurve;\n currentBottomCurve = lastBottomCurve;\n }\n if (topCurve.defined) {\n // 非法变合法需要lineTo,合法变非法需要moveTo,初始非法需要moveTo\n if (!defined0) {\n topList.push(currentTopCurve);\n bottomList.push(currentBottomCurve);\n drawAreaConnectBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n defined0 = !defined0;\n }\n } else {\n // 找到合法的点\n const { originP1, originP2 } = topCurve;\n let validTopCurve: ICurve<IPoint>;\n let validBottomCurve: ICurve<IPoint>;\n if (originP1 && originP1.defined !== false) {\n validTopCurve = currentTopCurve;\n validBottomCurve = currentBottomCurve;\n } else if (originP1 && originP2.defined !== false) {\n validTopCurve = topCurve;\n validBottomCurve = bototmCurve;\n }\n // 合法/(初始)变非法,moveTo\n if (defined0) {\n defined0 = !defined0;\n topList.push(validTopCurve || topCurve);\n bottomList.push(validBottomCurve || bototmCurve);\n } else {\n // 非法变非法/合法,看情况要不要lineTo\n if (validTopCurve) {\n // 非法变合法,需要lineTo\n defined0 = !defined0;\n topList.push(validTopCurve || topCurve);\n bottomList.push(validBottomCurve || bototmCurve);\n drawAreaConnectBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n }\n }\n }\n lastTopCurve = topCurve;\n // drawAreaBlock(path, topList, bottomList, params);\n } else {\n let tc: ICurve<IPoint> | null = null;\n let bc: ICurve<IPoint> | null = null;\n if (lastDefined !== topCurve.defined) {\n if (lastDefined) {\n drawAreaBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n } else {\n tc = topCurve;\n bc = bottom.curves[n - i - 1];\n }\n lastDefined = !lastDefined;\n } else {\n if (lastDefined) {\n tc = topCurve;\n bc = bottom.curves[n - i - 1];\n }\n }\n\n if (tc && bc) {\n if (percent < 1) {\n if (tc.p2 && tc.p3) {\n tc = divideCubic(tc as ICubicBezierCurve, percent)[0];\n } else {\n tc = divideLinear(tc as ILineCurve, percent)[0];\n }\n if (bc.p2 && bc.p3) {\n bc = divideCubic(bc as ICubicBezierCurve, 1 - percent)[1];\n } else {\n bc = divideLinear(bc as ILineCurve, 1 - percent)[1];\n }\n }\n tc.defined = lastDefined;\n bc.defined = lastDefined;\n topList.push(tc);\n bottomList.push(bc);\n }\n\n tc = null;\n bc = null;\n }\n }\n\n if (drawConnect) {\n drawAreaConnectBlock(path, topList, bottomList, params);\n } else {\n drawAreaBlock(path, topList, bottomList, params);\n }\n\n // const totalLength = segPath.tryUpdateLength();\n\n // // 直到上次绘制的长度\n // let drawedLengthUntilLast = 0;\n // for (let i = 0, n = curves.length; i < n; i++) {\n // const curve = curves[i];\n // const curCurveLength = curve.getLength();\n // const _p = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;\n // drawedLengthUntilLast += curCurveLength;\n // if (_p < 0) {\n // break;\n // }\n\n // // 跳过这个点\n // if (!curve.defined()) {\n // needMoveTo = true;\n // continue;\n // }\n // if (needMoveTo) {\n // path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY);\n // }\n // drawSegItem(path, curve, min(_p, 1), params);\n // needMoveTo = false;\n // }\n}\n\nfunction drawAreaConnectBlock(\n path: IPath2D,\n topList: ICurve<IPoint>[],\n bottomList: ICurve<IPoint>[],\n params?: {\n offsetX?: number;\n offsetY?: number;\n offsetZ?: number;\n mode?: 'none' | 'connect' | 'zero';\n zeroX?: number;\n zeroY?: number;\n }\n) {\n if (topList.length < 2) {\n return;\n }\n const { offsetX = 0, offsetY = 0, offsetZ = 0, mode } = params || {};\n let curve = topList[0];\n // mode不支持zero\n path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n curve = topList[topList.length - 1];\n let end = curve.p3 || curve.p1;\n path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ);\n\n curve = bottomList[bottomList.length - 1];\n path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n curve = bottomList[0];\n end = curve.p3 || curve.p1;\n path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ);\n\n path.closePath();\n}\n\nfunction drawAreaBlock(\n path: IPath2D,\n topList: ICurve<IPoint>[],\n bottomList: ICurve<IPoint>[],\n params?: {\n offsetX?: number;\n offsetY?: number;\n offsetZ?: number;\n }\n) {\n const { offsetX = 0, offsetY = 0, offsetZ = 0 } = params || {};\n let needMoveTo = true;\n topList.forEach(curve => {\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n return;\n }\n if (needMoveTo) {\n path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, 1, params);\n needMoveTo = false;\n });\n needMoveTo = true;\n for (let i = bottomList.length - 1; i >= 0; i--) {\n const curve = bottomList[i];\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n continue;\n }\n if (needMoveTo) {\n // bottom需要直接line绘制\n path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, 1, params);\n needMoveTo = false;\n }\n path.closePath();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common/render-area.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AAEvC,mCAAoC;AACpC,+DAA2D;AAC3D,+CAAoD;AACpD,iDAA6C;AAW7C,SAAgB,gBAAgB,CAC9B,IAAa,EACb,OAAuB,EACvB,OAAe,EACf,MAKC;;IAGD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEhC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QAC9C,OAAO;KACR;IACD,IAAI,OAAO,IAAI,CAAC,EAAE;QAChB,MAAM,OAAO,GAAqB,EAAE,CAAC;QACrC,MAAM,UAAU,GAAqB,EAAE,CAAC;QACxC,IAAI,WAAW,GAAY,IAAI,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,WAAW,KAAK,QAAQ,CAAC,OAAO,EAAE;gBACpC,IAAI,WAAW,EAAE;oBACf,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;oBACjD,OAAO,CAAC,MAAM,GAAG,CA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AAU,EAAE;YAEd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC;SAClE;QACD,IAAA,0BAAW,EAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACpC,UAAU,GAAG,KAAK,CAAC;KACpB;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;AACnB,CAAC","file":"render-area.js","sourcesContent":["import type { IPoint } from '@visactor/vutils';\nimport { abs } from '@visactor/vutils';\nimport type { IAreaCacheItem, ICubicBezierCurve, ICurve, IDirection, ILineCurve, IPath2D } from '../interface';\nimport { Direction } from './enums';\nimport { divideCubic } from './segment/curve/cubic-bezier';\nimport { divideLinear } from './segment/curve/line';\nimport { drawSegItem } from './render-utils';\n\n/**\n * 绘制连续的线段\n * 绘制长度为总长度percent的path,drawDirection为绘制的方向,也就是percent的方向\n * @param path\n * @param segPath\n * @param percent\n * @param drawDirection 绘制的方向,用于使用percent绘制\n * @param line 用于获取line相关属性\n */\nexport function drawAreaSegments(\n path: IPath2D,\n segPath: IAreaCacheItem,\n percent: number,\n params?: {\n offsetX?: number;\n offsetY?: number;\n offsetZ?: number;\n direction?: IDirection;\n }\n) {\n // let needMoveTo: boolean = true;\n const { top, bottom } = segPath;\n // 如果top和bottom的curves数量不同,那么就跳过\n if (top.curves.length !== bottom.curves.length) {\n return;\n }\n if (percent >= 1) {\n const topList: ICurve<IPoint>[] = [];\n const bottomList: ICurve<IPoint>[] = [];\n let lastDefined: boolean = true;\n for (let i = 0, n = top.curves.length; i < n; i++) {\n const topCurve = top.curves[i];\n if (lastDefined !== topCurve.defined) {\n if (lastDefined) {\n drawAreaBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n } else {\n topList.push(topCurve);\n bottomList.push(bottom.curves[n - i - 1]);\n }\n lastDefined = !lastDefined;\n } else {\n if (lastDefined) {\n topList.push(topCurve);\n bottomList.push(bottom.curves[n - i - 1]);\n }\n }\n }\n drawAreaBlock(path, topList, bottomList, params);\n\n return;\n }\n if (percent <= 0) {\n return;\n }\n\n let { direction } = params || {};\n const { curves: topCurves } = top;\n const endP = topCurves[topCurves.length - 1].p3 ?? topCurves[topCurves.length - 1].p1;\n const xTotalLength = abs(endP.x - topCurves[0].p0.x);\n const yTotalLength = abs(endP.y - topCurves[0].p0.y);\n direction = direction ?? (xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN);\n if (!Number.isFinite(xTotalLength)) {\n direction = Direction.COLUMN;\n }\n if (!Number.isFinite(yTotalLength)) {\n direction = Direction.ROW;\n }\n\n // x和y必须始终保持同方向\n // 整个线段的总长度(基于水平、垂直方向)\n const totalLength: number = direction === Direction.ROW ? xTotalLength : yTotalLength;\n\n // 总需要绘制的长度\n const totalDrawLength = percent * totalLength;\n // 直到上次绘制的长度\n let drawedLengthUntilLast = 0;\n let lastDefined: boolean = true;\n const topList: ICurve<IPoint>[] = [];\n const bottomList: ICurve<IPoint>[] = [];\n const defined0 = true;\n let lastTopCurve: ICurve<IPoint>;\n let lastBottomCurve: ICurve<IPoint>;\n for (let i = 0, n = top.curves.length; i < n; i++) {\n const topCurve = top.curves[i];\n const curCurveLength = topCurve.getLength(direction);\n const percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;\n if (percent < 0) {\n break;\n }\n drawedLengthUntilLast += curCurveLength;\n\n let tc: ICurve<IPoint> | null = null;\n let bc: ICurve<IPoint> | null = null;\n if (lastDefined !== topCurve.defined) {\n if (lastDefined) {\n drawAreaBlock(path, topList, bottomList, params);\n topList.length = 0;\n bottomList.length = 0;\n } else {\n tc = topCurve;\n bc = bottom.curves[n - i - 1];\n }\n lastDefined = !lastDefined;\n } else {\n if (lastDefined) {\n tc = topCurve;\n bc = bottom.curves[n - i - 1];\n }\n }\n\n if (tc && bc) {\n if (percent < 1) {\n if (tc.p2 && tc.p3) {\n tc = divideCubic(tc as ICubicBezierCurve, percent)[0];\n } else {\n tc = divideLinear(tc as ILineCurve, percent)[0];\n }\n if (bc.p2 && bc.p3) {\n bc = divideCubic(bc as ICubicBezierCurve, 1 - percent)[1];\n } else {\n bc = divideLinear(bc as ILineCurve, 1 - percent)[1];\n }\n }\n tc.defined = lastDefined;\n bc.defined = lastDefined;\n topList.push(tc);\n bottomList.push(bc);\n }\n\n tc = null;\n bc = null;\n }\n\n drawAreaBlock(path, topList, bottomList, params);\n\n // const totalLength = segPath.tryUpdateLength();\n\n // // 直到上次绘制的长度\n // let drawedLengthUntilLast = 0;\n // for (let i = 0, n = curves.length; i < n; i++) {\n // const curve = curves[i];\n // const curCurveLength = curve.getLength();\n // const _p = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;\n // drawedLengthUntilLast += curCurveLength;\n // if (_p < 0) {\n // break;\n // }\n\n // // 跳过这个点\n // if (!curve.defined()) {\n // needMoveTo = true;\n // continue;\n // }\n // if (needMoveTo) {\n // path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY);\n // }\n // drawSegItem(path, curve, min(_p, 1), params);\n // needMoveTo = false;\n // }\n}\n\nfunction drawAreaBlock(\n path: IPath2D,\n topList: ICurve<IPoint>[],\n bottomList: ICurve<IPoint>[],\n params?: {\n offsetX?: number;\n offsetY?: number;\n offsetZ?: number;\n }\n) {\n const { offsetX = 0, offsetY = 0, offsetZ = 0 } = params || {};\n let needMoveTo = true;\n topList.forEach(curve => {\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n return;\n }\n if (needMoveTo) {\n path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, 1, params);\n needMoveTo = false;\n });\n needMoveTo = true;\n for (let i = bottomList.length - 1; i >= 0; i--) {\n const curve = bottomList[i];\n // 跳过这个点\n if (!curve.defined) {\n needMoveTo = true;\n continue;\n }\n if (needMoveTo) {\n // bottom需要直接line绘制\n path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ);\n }\n drawSegItem(path, curve, 1, params);\n needMoveTo = false;\n }\n path.closePath();\n}\n"]}
|