Add new process for generate gradients

create function and modify mixins for gradient generation…

I change the code to make it more flexible.