Git Product home page Git Product logo

Comments (4)

FarazzShaikh avatar FarazzShaikh commented on August 28, 2024

The <Base /> layer is more of a <Color /> layer. It provides a nice solid color. This is useful to, for example, darken a given material. You could do:

<Base color="black" alpha={0.3} />

Or fi you want to give something a specific tint.

Maybe we should rename <Base /> to <Color />

from lamina.

DennisSmolek avatar DennisSmolek commented on August 28, 2024
<Base color="black" alpha={0.3} />

Maybe we should rename <Base /> to <Color />

I REALLY like the concept of a Color and agree that Base would be one, but the concept of it being a "base" is important

Many layers (Noise, displacement, etc) require a base color to be set and it's often something people mess up and get confused/frustrated when the stack doesn't seem to be "working"

One method is to require that a ColorLayer (or one that satisfies the requirement) be present somewhere in the stack, order being irrelevant.

<LayerMaterial>
    <Nosie />
    <Color value="red" mode="multiply" />
    <Texture />
</LayerMaterial>

A 100% opaque Color will block the alpha values of subsequent color layers like Gradient

<LayerMaterial>
    <Color value="red" />
    <Texture />
    <Gradient type=”circular” colors={[rgba(0,0,0,100), rgba(0,0,0,0)] />
</LayerMaterial>

So if one is present and not otherwise called, the base should be ignored
baseColorBlocking

But I think the biggest things are

  1. if people forget to define it defauting to the most likely need keeps the stack safe:
<LayerMaterial>
    <!-- baseline <Color value="black" /> -->
    <Texture />
</LayerMaterial>
  1. Keeps things cleaner when doing simple colors:
const [baseColor, setBaseColor] = useState('#32A0CF');
<LayerMaterial color={baseColor}>
    <Texture mode="screen" />
</LayerMaterial>

from lamina.

FarazzShaikh avatar FarazzShaikh commented on August 28, 2024

Yeah that sounds good to me. Having a color prop on the layer material itself could be the "base" color. And we could rename <Base /> to <Color /> Like this:

<LayerMaterial color="lightblue"> πŸ‘ˆ Base color
    <Noise mode="screen" />
    <Color color="red" mode="multiply" /> πŸ‘ˆ Give the noise red tint
</LayerMaterial>

from lamina.

FarazzShaikh avatar FarazzShaikh commented on August 28, 2024

Addressed in 1.1.0

from lamina.

Related Issues (20)

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.