-
Notifications
You must be signed in to change notification settings - Fork 376
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
base: master
Are you sure you want to change the base?
animation api #1551
Conversation
if (!toVal && index > 0) { | ||
const { rules: lastRules, transform: lastTransform } = actions[index - 1] | ||
// 非第一轮取上一轮的 | ||
toVal = lastRules.get(key) || lastTransform.get(key) |
There was a problem hiding this comment.
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+/) |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上==0和>3时的处理吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split之后单位需要tranUnit,比如10px需要转为数字10
No description provided.