DEV Community

Joan León
Joan León

Posted on

1 1

CSS Community Dev Logo, CSS Houdini version

Medellín CSS community launched a challenge to make the CSS Community Dev logo with CSS code.

And here my CSS Houdini version.

Source Code

Take a look to the source code, this is the Paint Worlet code.

registerPaint(
  'csscommunitydev',
  class {
    paint(ctx, geometry) {
      const {width: w, height: h} = geometry

      // Background
      ctx.beginPath()
      ctx.arc(w / 2, h / 2, w / 2, 0, 2 * Math.PI)
      ctx.fillStyle = '#6F0E96'
      ctx.fill()

      // Shadow
      const grShadow = ctx.createRadialGradient(
        w / 2,
        h / 2,
        0,
        w / 2,
        h / 2,
        w / 3.2
      )
      grShadow.addColorStop(0, 'rgba(0,0,0,0.6)')
      grShadow.addColorStop(1, 'rgba(111, 14, 150, 1)')
      ctx.beginPath()
      ctx.arc(w / 2, h / 2, w / 2.4, 0, 2 * Math.PI)
      ctx.fillStyle = grShadow
      ctx.fill()

      // Semi circle
      const grSemicircle = ctx.createLinearGradient(
        h * 0.133,
        w * 0.47,
        w * 0.47,
        h * 0.864
      )
      grSemicircle.addColorStop(0, '#975DF5')
      grSemicircle.addColorStop(1, '#6F0E96')
      ctx.beginPath()
      ctx.arc(w * 0.47, h / 2, w * 0.37, Math.PI * 0.5, Math.PI * 1.5)
      ctx.fillStyle = grSemicircle
      ctx.shadowColor = 'rgba(0,0,0,0.3)'
      ctx.shadowBlur = h * 0.06
      ctx.shadowOffsetX = w * 0.1
      ctx.shadowOffsetY = 0
      ctx.fill()

      // First triangle
      const grFirstTriangle = ctx.createLinearGradient(
        w * 0.56,
        h * 0.327,
        w * 0.786,
        h * 0.456
      )
      grFirstTriangle.addColorStop(0, '#43DCC9')
      grFirstTriangle.addColorStop(1, '#05F2C7')
      ctx.beginPath()
      ctx.moveTo(w * 0.56, h * 0.327)
      ctx.lineTo(w * 0.786, h * 0.197)
      ctx.lineTo(w * 0.786, h * 0.456)
      ctx.fillStyle = grFirstTriangle
      ctx.shadowColor = 'rgba(0,0,0,0.5)'
      ctx.shadowBlur = h * 0.06
      ctx.shadowOffsetX = w * -0.02
      ctx.shadowOffsetY = h * 0.08
      ctx.fill()

      // Second triangle
      const grSecondTriangle = ctx.createLinearGradient(
        w * 0.56,
        h * 0.412,
        w * 0.56,
        h * 0.802
      )
      grSecondTriangle.addColorStop(0, '#FFD900')
      grSecondTriangle.addColorStop(1, '#FF6A19')
      ctx.beginPath()
      ctx.moveTo(w * 0.56, h * 0.412)
      ctx.lineTo(w * 0.9, h * 0.606)
      ctx.lineTo(w * 0.56, h * 0.802)
      ctx.fillStyle = grSecondTriangle
      ctx.shadowColor = 'rgba(0,0,0,0.5)'
      ctx.shadowBlur = h * 0.08
      ctx.shadowOffsetX = w * 0.04
      ctx.shadowOffsetY = h * 0.08
      ctx.fill()
    }
  }
)
Enter fullscreen mode Exit fullscreen mode

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more