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

universal-animation: formatBezier returns error value #125

Open
tatowilson opened this issue Dec 24, 2020 · 3 comments
Open

universal-animation: formatBezier returns error value #125

tatowilson opened this issue Dec 24, 2020 · 3 comments

Comments

@tatowilson
Copy link

According to BindingX Doc,

In particular, the cubicBezier function is used to customize the Bessel curve, which is defined as follows:

  • cubicBezier(t, begin, changeBy, duration, controlX1, controlY1, controlX2, controlY2)
    • input parameter:
      • t: time of animation execution
      • begin: attribute starting value
      • changeBy: attribute change value (end - start)
      • duration: duration of animation
      • controlX1: x coordinates of The first control point
      • controlY1: y coordinates of The first control point
      • controlX2: x coordinates of The second control point
      • controlY2: y coordinates of The second control point
    • return:
      • Void

the cubicBezier function's last 4 parameters are controlX1, controlY1, controlX2, controlY2.

In this animation implementation, we get the return value of formatBezier function, and join the result with ',' so that we pass it as the last 4 parameters for the cubicBezier function.

let bezier = formatBezier(prop.easing || easing);
let expression = bezier && bezier.length === 4 ?
`cubicBezier(t-${prop.delay},${start},${prop.end - start},${prop.duration},${bezier.join(',')})`
: `${prop.easing || easing}(t-${prop.delay},${start},${prop.end - start},${prop.duration})`;

However, the formatBezier function returns [m[1], m[4], m[3], m[4]] -- in my opinion, it means controlX1, controlY2, controlX2, controlY2.

export default function formatBezier(easing) {
if (easing) {
let m = easing.match(/cubicBezier\((.+),(.+),(.+),(.+)\)/);
return m && [m[1], m[4], m[3], m[4]];
}
}

Should it return [m[1], m[2], m[3], m[4]] rather than [m[1], m[4], m[3], m[4]]?

@SoloJiang
Copy link
Collaborator

Can u give us a PR?

@SoloJiang
Copy link
Collaborator

Please fix the stable branch, @uni/animation won't support weex, so it will remove bindingX

@tatowilson
Copy link
Author

Please fix the stable branch, @uni/animation won't support weex, so it will remove bindingX

I've changed the target branch to stable, please review PR #162 again

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

No branches or pull requests

2 participants