An interactive, low-boilerplate creative coding platform

Overview

nightgraph

A creative coding platform in Rust. Provides drawing APIs, a CLI, Native and WASM GUIs, and low-boilerplate artwork creation. Designed initially for @night_generator pen-plotter works, but steadily expanding into a general purpose platform. Artwork of human sitting, stylized similarly to contour lines or CP-1919/"Unknown Pleasures"

Status

This project is in very early active development, and probably shouldn't be used by anyone until it's first release in the near future 💜

With that said, there are a lot of exciting features on the roadmap:

  • Scripting language and/or node editor for user created sketches at runtime.
  • Keyframes/animations in nightgraph-ui, as well as rendering to various video formats
  • Higher order geometric operations: clustering, fracturing, tiling, canvas-iterating operations.
  • Forward-porting @night_generator works written in a previous version of this platform (such as Kinect scans).

and many more in this project's issues.

Crates

nightgraphics

A 2D drawing API, with a collection of shapes primitives as well as standard operations on them, and between other shapes, and a canvas to place them on and render from.

nightsketch

An internal crate used by nightgraph-ui and nightgraph-cli to store, expose, and modify sketches (self contained works of art written in nightgraphics).

nightgraph-ui

A GUI written in egui that displays nightsketch sketches, as well as auto-generated controls from their parameters. Runs natively on all Linux/MacOS/Windows, or in any modern web browser via wasm.

nightgraph-cli

A CLI for nightsketch sketches that lists sketches, their parameters, descriptions for both, and allows rendering sketches to SVGs with modified values.

nightsketch_derive

An internal crate that greatly simplifies the act of adding new sketches to nightsketch. Through doc comments, attributes, and object naming, CLI/GUI controls are auto-generated for selection of sketches, setting of parameters, etc.

Credit & Licenses

This project and its contained crates are licensed under the MIT license. Any artwork generated by an existing sketch, such as sketch/src/blossom.rs, is licensed CC BY 4.0. Artwork can be attributed to Kyle Kneitinger ([email protected]), or @night_generator on Instagram.

Jost-500-Medium.otf and Jost-400-Book.otf by indestructible type*, SIL Open Font License

Monofur_Regular.ttf by Tobias Köhler, Custom "Freeware" License

nightgraph-ui derived from emilk/eframe_template

Comments
  • [WIP] UI Specifiable Sketches

    [WIP] UI Specifiable Sketches

    Status

    Screenshot of nightgraph-ui with specifiable sketches right now, this PR is just a rough hard-coding of the type of code that a macro like #[sketchlist] would generate.

    Aesthetically (in both the UI and the macros) there is a bit to figure out still, but the foundation seems solid enough.

    Todo

    • [ ] Add sketchlist macro. The scratch commit in this PR has it as an attribute macro, but that might be kind of clunky since it needs to apply to an item. In this case, a module is the only semi-appropriate item, and even that feels clunky since its contents are not really going to be passed through to the resulting code. A better choice might be a proc macro function-like macro.
    • [ ] Prettier sketch selection in UI. Right now it is hard-coded radio buttons as a proof of concept. egui selectable labels might be more visually appealing, but a drop down might make the most sense.
    • [ ] Adding a sketch to the sketch list (in whatever form it takes) should be a one line operation (regardless of egui or clap).
    opened by kneitinger 2
  • Minor fix collection

    Minor fix collection

    1. set's the "js" function of the getrandom crate to enable sketches to use random values when compiled to wasm.
    2. Addresses trivial clippy warnings
    3. With the release of the clap 3.0.0 release candidates, a "derive" feature now needs to be set to use derive macros.
    opened by kneitinger 0
  • Add #plotparty sketches and some small features

    Add #plotparty sketches and some small features

    • Corrects bug in PathBuilder's smooth() + close() case.
    • Removes generation of short names for sketch parameters since they are too likely to collider with global options or other parameters.
    • Adds a builder for Poly
    • Adds "App Settings" section to the UI's side panel, currently only for a UI scale setting.
    • Adds five sketches
    opened by kneitinger 0
  • `nightgraph-ui` sketch parameteres should be able to be reset to default values.

    `nightgraph-ui` sketch parameteres should be able to be reset to default values.

    A reset button should be present in the "Sketch Settings" collapsible heading section that returns zoom, and all parameters to their defaults.

    Currently, defaults are not communicated to the UI, so nightsketch::metadata::ParamMetadata should have a default value field added, or functions should be provided that return the default val by id, like how getting/setting currently works.

    internals macro ui 
    opened by kneitinger 0
  • Allow specification of stroke widths

    Allow specification of stroke widths

    Previously, stroke widths were all set to a hard coded value (0.5mm for SVG, 2px for egui), and there was no way for individual shapes to have different stroke widths.

    Now, a stroke_width field is present on all shapes, and an option exists for setting them in TextBuilder and PathBuilder.

    Additionally, paths drawn in nightgraph-ui were a fixed size regardless of zoom level. Now they scale accordingly.

    opened by kneitinger 0
  • Allow specifying where rendered SVGs are stored

    Allow specifying where rendered SVGs are stored

    Adds a path argument to nightgraphics::render::svg::SvgRenderer and an --output arg to nightgraph-cli

    nightgraph-cli

    nightgraph-cli 0.1.0
    
    Kyle Kneitinger <[email protected]>
    
    A runner for nightgraph sketches
    
    USAGE:
        nightgraph-cli [OPTIONS] <SUBCOMMAND>
    
    OPTIONS:
        -h, --help               Print help information
            --output <OUTPUT>    Path where the resulting SVG file is stored [default: drawing.svg]
        -V, --version            Print version information
    
    SUBCOMMANDS:
        blossom    A series of lightly complex sine modulated rings around the center of the page
                   with optional text cutout
        help       Print this message or the help of the given subcommand(s)
    

    Fixes #12

    opened by kneitinger 0
  • UI Selectable Sketches

    UI Selectable Sketches

    For information see #15. The first prototype is featured there, but a slightly different approach was taken here, and the sketch crate was heavily refactored since then too, so it made sense to post a new PR.

    Design considerations covered in #15 as well

    Fixes #2

    opened by kneitinger 0
  • Restructure UI crate

    Restructure UI crate

    Moves sketch related data and associated UI controls to own module (sketch_control).

    Moves drawing/page controls to drawing module.

    Moves font setup operations to own function (this pattern should be followed for other setup ops, such as UI scaling, etc.

    internals 
    opened by kneitinger 0
  • Restructure `nightsketch` crate

    Restructure `nightsketch` crate

    Breaks sketch related traits and parameter metadata structs/enums out of nightsketch/src/lib.rs and into nightsketch/src/sketch.rs and nightsketch/src/metadata.rs respectively.

    Additionally, moves the Blossom sketch's exp_dec and sin_component functions into a new nightgraphics::utils module.

    opened by kneitinger 0
  • Consolidate assets directories

    Consolidate assets directories

    There are currently 3 places assets live:

    Combining these into an assets directory with subdirectories for fonts, 'imgs`, etc would be a nice thing to do :)

    internals 
    opened by kneitinger 0
  • nightgraph-cli should have a universal `--output` argument for specifying the path of the resultant SVG

    nightgraph-cli should have a universal `--output` argument for specifying the path of the resultant SVG

    Currently, nightgraph-cli saves the rendered SVG as image.svg in the current working directory. This should obviously be able to be set by the user at runtime.

    Eventually, a stronger system of timestamped files/dirs and stored argument metadata should be implemented so that all images are reproducible. An issue should be filed for that when this issue's fix is in place.

    enhancement internals 
    opened by kneitinger 0
  • Create parameter groups and

    Create parameter groups and "important" parameters in `nightgraph-ui`

    When using many parameters in a sketch, the UI's parameter tab can get a bit cluttered. To relieve this,

    it would be nice to allow parameters to be grouped, for example the parameters for a sine wave being next to each other and padded from others with a separator...or even all of them being in an egui CollapsingHeader

    Even easier, it would be helpful to allow parameters to be tagged as important (or some similar and shorter word) and appear in the parameter panel as bold text

    #[param(default = 3, important)]
    sine_wave_count: u32
    
    enhancement ui 
    opened by kneitinger 0
  • All Shapes should have `Builder` structs

    All Shapes should have `Builder` structs

    With the addition of optionally-precomputed bounding boxes, and specifiable stroke widths (#25) the configuration options for a shape are getting quite numerous.

    Following the lead of PathBuilder and TextBuilder, all shapes should have an associated builder, and if appropriate, a central shape builder that can instantiate any shape might be nice.

    enhancement 
    opened by kneitinger 0
  • Zooming in on the `nightgraph-ui` canvas should be centered at the cursor

    Zooming in on the `nightgraph-ui` canvas should be centered at the cursor

    Currently, by zooming in to a drawing, the zoom point is the center of the canvas. It would feel far more natural to zoom to the point underneath the cursor.

    ui 
    opened by kneitinger 0
  • Expand unit test coverage

    Expand unit test coverage

    Goal

    At least 80% test coverage in repo.

    Tasks

    • [ ] nightsketch_derive macro internals
    • [x] #19
    • [ ] nightsketch features (testing clap derivations, etc)
    • [ ] nightgraphics geometry/canvas/render coverage improvement
    • [ ] nightgraph-ui custom components (sketch loading, parameter control generation, etc)

    Note

    I don't believe sketches themselves make sense to include in this figure

    testing 
    opened by kneitinger 0
  • Allow sketch text fields to be ui/cli params

    Allow sketch text fields to be ui/cli params

    The #[sketch] attribute macro in sketch_derive will currently autogenerate clap/custom code for setting integral, floating point and boolean values. A lot of my recent work uses text, and having that be a cli option or UI setting would be great.

    The general infrastructure for this is already in place; the main hurdle is just handling lifetimes/ownership with aggregate datatypes.

    For cli settings, quotations handle any whitespace/newlines. For UI, this setting should likely be a multiline text box.

    enhancement internals 
    opened by kneitinger 0
  • Audit errors/error handling

    Audit errors/error handling

    Currently each lib has decent error types, but their clarity/usage/etc. is inconsistent. All crate/mod error types should be reviewed and refined, and every occurrence of unwrap() should be checked and replaced unless completely certain a case is infallible.

    Once the errors are refined, nightgraph-cli and nightgraph-ui should report errors cleanly to the user. ui can have an error console, or use the tab/panel/etc described in #6

    internals 
    opened by kneitinger 0
Owner
Kyle Kneitinger
Kyle Kneitinger
A place to start when building webgl apps in Bevy. Use this to avoid writing the boilerplate.

Template Bevy project with WebGL enabled Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.to

Michael Dorst 0 Dec 24, 2021
A interactive and fun to use memory game written in Rust

memg - Memory Game memg is a interactive and fun to use memory game written in rust Installation Make sure you have rust installed. Use this official

null 4 Sep 9, 2021
An interactive, universal Wordle solver

Eldrow (Wordle in reverse) is an interactive, universal Wordle solver that attempts to achieve near to mathematically perfect performance without rely

agubelu 3 Sep 2, 2022
An opinionated, monolithic template for Bevy with cross-platform CI/CD, native + WASM launchers, and managed cross-platform deployment.

??️ Bevy Shell - Template An opinionated, monolithic template for Bevy with cross-platform CI/CD, native + WASM launchers, and managed cross-platform

Kurbos 218 Dec 30, 2022
A simple camera for properly displaying tile-based low resolution pixel perfect 2D games in bevy.

Bevy Tiled Camera A simple camera for properly displaying low resolution pixel perfect 2D games in bevy. The camera will adjust the viewport to scale

sark 10 Oct 5, 2022
A low-level library for OpenGL context creation, written in pure Rust.

glutin - OpenGL, UTilities and INput A low-level library for OpenGL context creation, written in pure Rust. [dependencies] glutin = "0.28.0" Documenta

Rust Windowing 1.8k Jan 5, 2023
A low-level library for OpenGL context creation, written in pure Rust.

glutin - OpenGL, UTilities and INput A low-level library for OpenGL context creation, written in pure Rust. [dependencies] glutin = "0.28.0" Documenta

Rust Windowing 1.8k Dec 25, 2022
Extreme Bevy is what you end up with by following my tutorial series on how to make a low-latency p2p web game.

Extreme Bevy Extreme Bevy is what you end up with by following my tutorial series on how to make a low-latency p2p web game. There game can be played

Johan Klokkhammer Helsing 39 Jan 5, 2023
A low-level gltf parser implemented on nanoserde

Goth-gltf aims to be a low-level, unopinionated reader for glTF files. In comparison with gltf-rs, it: Represents the glTF JSON structure transparentl

Ashley 18 Dec 27, 2022
Vel: A language for verified low-level software

Vel A language for verified low-level software. It dreams to be something like Rust with logic ― a language that empowers people to build verified low

Higher-Order Program Verification 9 Jan 26, 2023
A direct ecs to low-level server implementation for Godot 4.1

godot_ecs What if Godot 4.1 and Bevy got married? Well, you'd get one interesting duo of data driven goodness. In Development This crate is not produc

null 5 Oct 6, 2023
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

webview 10.8k Jan 9, 2023
Cross-platform game engine in Rust.

Cross-platform game engine in Rust.

Fedor Logachev 1.9k Jan 3, 2023
IDE for cross-platform software development

Diversity Space IDE for cross-platform software development | 日本語 | English | Русский | READMEの英語版とロシア語版はDeepl翻訳を使用して翻訳されています Английская и русская вер

latteS 0 Feb 23, 2022
A cross platform (wasm included) networking library!

bootleg_networking A cross platform (wasm included) networking library! A networking plugin for the Bevy game engine that wraps around bevy_networking

William Batista 51 Jan 1, 2023
This is a cross-platform tool to historicize different branches/depots/manifests and generating pseudocode for it to compare different game updates

CSHP This is a cross-platform tool to historicize different branches/depots/manifests and generating pseudocode for it to compare different game updat

raizo 6 Jan 28, 2022
Neutral cross-platform Rust game template

Rust Game Template Neutral cross-platform Rust game template. Build tool This project uses cargo-make task runner. It's required to build the project.

null 0 Feb 5, 2022
A lightweight, cross-platform epub reader.

Pend Pend is a program for reading EPUB files. Check out the web demo! Preview Image(s) Installation Building Pend is simple & easy. You should be abl

bx100 11 Oct 17, 2022
A simple new year redpacket platform.

Triangle A simple new year red packet quiz platform. Installation cargo install github.com/Yesterday17/triangle Usage First, write quiz in a TOML file

Yesterday17 3 Jan 31, 2022