kernel vec4 coreImageKernel(__sampler image1,
                            vec4 args1, vec4 args2) {
//  float u_blurRadius = args1.x;
//  float u_gradientSize  = args1.y;
//  float u_size  = args1.z;
//  float blurSteps = args1.w;
  vec2 u_position = args2.xy;
  vec2 u_delta = vec2(-0.5, 0.5);
  vec4 color = vec4(0.0);
  float total = 0.0;
  float percent;
  float weight;
  vec4 samplePix;
  vec2 dc = destCoord();

  float radius =  args1.x * smoothstep(
                                            0.0,
                                            1.0,
                                            (abs(distance(dc, u_position)) -  args1.z) / args1.y
                                            );

  for (float t = -args1.w; t <= args1.w; t++) {
    percent = t / args1.w;

    vec4 samplePix = sample(image1, samplerTransform(image1, destCoord() + u_delta * percent * radius));
    weight = (1.0 - abs(percent));
    color += vec4(samplePix.rgb * weight * samplePix.a, samplePix.a * weight);
    total += weight;
  }
  
  return color / total;
}
