Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lighting #21

Open
keithclark opened this issue Jun 8, 2019 · 0 comments
Open

Add lighting #21

keithclark opened this issue Jun 8, 2019 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@keithclark
Copy link
Owner

Support lighting models through CSS. Ideally this should:

  • Allow multiple lights to be defined using a single rule
  • Provide multiple light types (ambient, point, directional etc)
  • Play nicely with CSS principles - i.e use inheritance / cascade

Initial thoughts:

Allow CSS authors to use a custom property (--light?) to define lighting and access it with JavaScript using the CSSOM.

--light: <light-function> [<light-position>]? [<light-attachment>]?

Where:

  • <light-function> could be something along the lines of:
    • ambient-light(<color>, [<intensity>]?)
    • point-light(<color>, [<intensity>, [,distance]?]?)
  • <light-position> is a triplet of css <length>s:
    • -100px 200px 300px (defaults to 50% 50% 0?)
  • <light-attachment> is one of
    • fixed - light is clamped to the viewport / scrollbox?
    • absolute - light is positioned relative to the document?
    • static - light is is positioned / transformed relative to the element it's defined on.

Examples:

body {
  --light: ambient-light(#fff, .3),
      point-light(#f00, 1) 50% 50% 50% relative,
      point-light(#0f0, 1) 0px 300px 800px absolute,
      point-light(#00f,24) 700px 400px 800px static;
}
@keithclark keithclark added this to the 1.0.3 milestone Jun 8, 2019
@keithclark keithclark added the enhancement New feature or request label Jun 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant