Giter Site home page Giter Site logo

lucasdinonolte / sol Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 122 KB

Work in progress functional declarative 2D drawing programming language to combine two of my interests: Programming languages and conceptual art.

JavaScript 98.01% HTML 0.35% Svelte 1.65%
language programming-language

sol's Introduction

Sol

A declarative functional and reactive language for creative coding. Initially created to learn more about parsers and interpreters.

; const declares a constant
; cannot be changed
(const TL <0 0>)
(const TR <1 0>)
(const BL <0 1>)
(const BR <1 1>)
(const CENTER <0.5 0.5>)

; $ declares state
; state can be changed and will cause a re-render
($ s 1000)
($ c 100)
($ bgColor #121212)

; Lists need to be wrapped so they
; don't get mistaken for watched variable
($ positions ([ BL BR ]))

; You can also pass other state variables to watch
; will be re-calculated if s changes
($ SIZE [s] <s s>)
($ maxR [s] (* 2 s))

; def declares a named function
(def drawCircles [num origin] (
  (map (range num) (fn [n i] (
    (circle origin (* (+ 1 i) (/ maxR num)) { :stroke #f1f1f1 })
  )))
))

($ output [SIZE c positions bgColor] (draw [
  (rect <0 0> <s s> { :fill bgColor })
  (map positions (fn [pos] (
    (drawCircles c <(* s (vec/x pos)) (* s (vec/y pos))>)
  )))
]))

Usage

Should not yet be used for anything serious. But if you want to play with it, clone this repo and run.

npm run cli path/to/your/sketch.sol # or yarn or pnpm …

Why Sol?

Named after conceptual artist Sol LeWitt.

Is this a stupid idea?

Mostly yes, but also interesting.

Inspiration

sol's People

Contributors

lucasdinonolte avatar

Stargazers

 avatar  avatar

Watchers

 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.