I thought I share a cogwheel shader brush for those that are interested.
$this->bbcode_second_pass_code('', '
// From: http://mercury.sexy/hg_sdf/
float mod1(inout float p, float size) {
  float halfsize = size*0.5;
  float c = floor((p + halfsize)/size);
  p = mod(p + halfsize, size) - halfsize;
  return c;
}
float2 toPolar(float2 p) {
  return float2(length(p), atan2(p.y, p.x));
}
float2 toRect(float2 p) {
  return float2(p.x*cos(p.y), p.x*sin(p.y));
}
// From: http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float unevenCapsule(float2 p, float r1, float r2, float h) {
  p.x = abs(p.x);
  float b = (r1-r2)/h;
  float a = sqrt(1.0-b*b);
  float k = dot(p,float2(-b,a));
  if(k < 0.0) return length(p) - r1;
  if(k > a*h) return length(p-float2(0.0,h)) - r2;
  return dot(p, float2(a,b)) - r1;
}
float circle(float2 p, float r) {
  return length(p) - r;
}
// From: http://www.iquilezles.org/www/articles/smin/smin.htm
float softMin(float a, float b, float k)
{
    float h = clamp(0.5+0.5*(b-a)/k, 0.0, 1.0);
    return lerp(b, a, h) - k*h*(1.0-h);
}
float cogwheel(float2 p, float time) {
  float pi = 3.141592654;
  float tau = 2.0*pi;
  float scale = 2000.0;
  float cogRadius = 0.02*scale;
  float outerRadius = 0.30*scale;
  float innerRadius = 0.25*scale;
  float embeddedRadius = (0.125/2.0)*scale;
  float embeddedOffset = 0.15*scale;
  float smooth = 0.0375*scale;
  float dc = circle(p, innerRadius);  
  float2 pp = toPolar(p);
  pp.y += time*2 + tau/32.0;
  float2 cpp = pp;
  mod1(cpp.y, tau/16.0);
  cpp.y += PI/2.0;
  float2 cp = toRect(cpp);
  float ds = unevenCapsule(cp, 0.05, cogRadius, outerRadius);
  float dcw = softMin(ds, dc, smooth);
//  float dcw = min(ds, dc);
  float dic = circle(p, embeddedRadius);
  float2 ipp = pp;
  mod1(ipp.y, tau/6.0);
  float2 ip = toRect(ipp);
  float dic2 = circle(ip - float2(embeddedOffset, 0.0), embeddedRadius);
  float di = min(dic, dic2);
  return max(dcw, -di);
}
float df(float2 p, float time) 
{
  float d =cogwheel(p, time);
  d = abs(d) - 5.0;
  return d;
}
float4 main(idatas i)
{
  float fuzzy = 1.0;
  float d = df(i.pos - i.strokePos, 0.01*i.nbUserStroke);
  float s = smoothstep(-fuzzy, fuzzy, d);
  float4 b = float4(0.0, 0.0, 0.0, 0.0);
  float4 col = lerp(i.color, b, s);
  return col;
}
')
			
