Coder Social home page Coder Social logo

cell's Introduction

about

Declaratively generate Vera Molnár inspired images using the CSS Paint API.

setup

Download from GitHub directly:

# Add to package.json
npm install thewhodidthis/cell

usage

Load JS first:

// Load worklet
if ("paintWorklet" in CSS) {
  CSS.paintWorklet
    .addModule("https://thewhodidthis.github.io/cell/cell.js")
    .catch(console.log)
}

Then in CSS:

@supports (background: paint(_)) {
  :host {
    background: whitesmoke;
    border: 0.20625rem solid transparent;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
  }
  div {
    --cell-fill-style: transparent;

    background-image:
      paint(quad),
      paint(quad),
      paint(quad),
      paint(quad),
      paint(quad),
      paint(quad);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100%, 88%, 76%, 64%, 52%, 40%;
    margin: -0.4125rem;
  }
  div:nth-child(2n + 1) {
    background-size: 100%, 88%, 64%, 52%, 24%, 12%;
  }
  div:nth-child(3n + 2) {
    background-size: 100%, 88%, 76%, 0, 52%, 40%;
  }
  div:nth-child(5n + 3) {
    background-size: 100%, 88%, 76%, 64%, 40%, 12%;
  }
}

see also

cell's People

Contributors

thewhodidthis avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.