Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

animation api #1551

Open
wants to merge 71 commits into
base: master
Choose a base branch
from
Open

animation api #1551

wants to merge 71 commits into from

Conversation

wenwenhua
Copy link
Collaborator

No description provided.

@wenwenhua wenwenhua changed the title feat: init animation api animation api Jul 17, 2024
if (!toVal && index > 0) {
const { rules: lastRules, transform: lastTransform } = actions[index - 1]
// 非第一轮取上一轮的
toVal = lastRules.get(key) || lastTransform.get(key)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上一轮也不一定有值

duration,
delay,
timingFunction,
transformOrigin: transformOrigin.split(/\s+/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要正规化为三元组,而不是单纯split

})
}
// 创建单个animation
function getAnimation ({ key, value }: { key: string, value: string|number }, { delay, duration, easing }: ExtendWithTimingConfig, callback: boolean | AnimationCallback = false) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个callback类型怎么能是boolean呢。。

toVal = lastRules.get(key) || lastTransform.get(key)
}
const animation = getAnimation({ key, value: toVal! }, { delay, duration, easing }, !isSetTransformOrigin && setTransformOrigin)
isSetTransformOrigin = true
Copy link
Collaborator

@hiyuki hiyuki Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为needSetCallback吧,初始值为当前step是否存在transformOrigin,一个step设置过一次之后置为false

duration = DEFAULT.duration,
delay = DEFAULT.delay,
timingFunction = DEFAULT.timingFunction,
transformOrigin = DEFAULT.transformOrigin
Copy link
Collaborator

@hiyuki hiyuki Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要确认是不是每次transformOrigin都会置为默认值, 如果每个step都有默认值的话,后面那个地方每个step必然要设置transformOrigin,就不用判断那个是否need了


_formatTransformOrigin (transformOrigin) {
const transformOriginArr = transformOrigin.split(/\s+/)
if (transformOriginArr.length === 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加上==0和>3时的处理吧

Copy link
Collaborator

@hiyuki hiyuki Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split之后单位需要tranUnit,比如10px需要转为数字10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants