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

06. 两个颜色间过渡 #6

Open
Jesonhu opened this issue Oct 16, 2018 · 0 comments
Open

06. 两个颜色间过渡 #6

Jesonhu opened this issue Oct 16, 2018 · 0 comments
Labels
JavaScript 框架&库&工具 工具:包括常用代码整理

Comments

@Jesonhu
Copy link
Owner

Jesonhu commented Oct 16, 2018

// Notice: 
`_this.slideProgress` ji

/**
 * 粉色255,72,145 过渡到 灰色51,51,51
 */
// 放大平方(2次方)倍的变化速率
r = Math.floor((255 - 51) * (1 - Math.pow(Math.abs(_this.slideProgress), 2)) + 51)
g = Math.floor((72 - 51) * (1 - Math.pow(Math.abs(_this.slideProgress), 2)) + 51)
b = Math.floor((145 - 51) * (1 - Math.pow(Math.abs(_this.slideProgress), 2)) + 51)

// 正常变化速率
r = Math.floor((255 - 51) * (1- Math.abs(_this.slideProgress)) + 51)
g = Math.floor((72 - 51) * (1 - Math.abs(_this.slideProgress)) + 51)
b = Math.floor((145 - 51) * (1 - Math.abs(_this.slideProgress)) + 51)

参考资料

@Jesonhu Jesonhu added JavaScript 框架&库&工具 工具:包括常用代码整理 labels Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScript 框架&库&工具 工具:包括常用代码整理
Projects
None yet
Development

No branches or pull requests

1 participant