Metadata-Version: 2.1
Name: flitter-lang
Version: 1.0.0b20
Summary: Flitter is a functional programming language and declarative system for describing 2D and 3D visuals
Author-email: Jonathan Hogg <me@jonathanhogg.com>
Maintainer-email: Jonathan Hogg <me@jonathanhogg.com>
License: Copyright (c) 2024, Jonathan Hogg
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Documentation, https://flitter.readthedocs.io/
Project-URL: Repository, https://github.com/jonathanhogg/flitter.git
Project-URL: Issues, https://github.com/jonathanhogg/flitter/issues
Keywords: language,opengl,live-coding,live-visuals
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Environment :: Console
Classifier: Environment :: GPU
Classifier: Environment :: MacOS X
Classifier: Environment :: X11 Applications
Classifier: Topic :: Artistic Software
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: av
Requires-Dist: glfw
Requires-Dist: lark
Requires-Dist: loguru
Requires-Dist: mako
Requires-Dist: manifold3d
Requires-Dist: moderngl
Requires-Dist: networkx
Requires-Dist: numpy
Requires-Dist: pillow >=10.1.0
Requires-Dist: pyserial
Requires-Dist: pyusb
Requires-Dist: regex
Requires-Dist: rtmidi2
Requires-Dist: scipy
Requires-Dist: skia-python >=117.0b3
Requires-Dist: trimesh
Provides-Extra: macos
Requires-Dist: pyobjc-core ; extra == 'macos'
Requires-Dist: pyobjc-framework-Cocoa ; extra == 'macos'

![Screenshot from a Flitter program showing colourful distorted ellipse shapes
with trails moving outwards from the centre of the screen.](https://github.com/jonathanhogg/flitter/raw/main/docs/header.jpg)

# Flitter

[![CI lint](https://github.com/jonathanhogg/flitter/actions/workflows/ci-lint.yml/badge.svg?)](https://github.com/jonathanhogg/flitter/actions/workflows/ci-lint.yml)
[![CI test](https://github.com/jonathanhogg/flitter/actions/workflows/ci-test.yml/badge.svg?)](https://github.com/jonathanhogg/flitter/actions/workflows/ci-test.yml)
[![CI coverage](https://gist.githubusercontent.com/jonathanhogg/b7237d8b4e7ff50c3f284cb939e949d0/raw/badge.svg?)](https://github.com/jonathanhogg/flitter/actions/workflows/ci-coverage.yml)
[![docs](https://readthedocs.org/projects/flitter/badge/?version=latest)](https://flitter.readthedocs.io/en/latest/?badge=latest)

**Flitter** is a functional programming language and declarative system for
describing 2D and 3D visuals. It is designed to encourage an iterative,
explorative, play-based approach to constructing visuals.

[The language](https://flitter.readthedocs.io/en/latest/language.html) supports
the basic range of functional language features: first-class recursive and
anonymous functions, comprehensions, let/where, conditional expressions, lists
("vectors"). However, unusually, all values are vectors and all operators are
element-wise, and the language is built around constructing trees of attributed
nodes. The language is designed to be familiar to Python programmers.

The engine is able to live reload all code and assets (including any shaders,
images, videos, models, etc.) while retaining the current system state - thus
supporting live-coding. It also has support for interacting with running
programs via MIDI surfaces (plus basic pointer and keyboard support).

**Flitter** is implemented in a mix of Python and Cython and requires at least
OpenGL 3.3 (Core Profile) or OpenGL ES 3.0. At least Python 3.10 is also
required as the code uses `match`/`case` syntax.

**Flitter** is designed for expressivity and ease of engine development over
raw performance, but is fast enough to be able to do interesting things.

The engine that runs the language is capable of:

- [2D drawing](https://flitter.readthedocs.io/en/latest/canvas.html) (loosely
  based on an HTML canvas/SVG model)
- [3D rendering](https://flitter.readthedocs.io/en/latest/canvas3d.html),
  including:
  - primitive box, sphere, cylinder and cone shapes
  - external triangular mesh models in a variety of formats including OBJ
    and STL
  - planar slicing, union, difference and intersection of solid models
  - ambient, directional, point/sphere, line/capsule and spotlight sources
    (currently shadowless)
  - multiple (simultaneous) cameras with individual control over location,
    field-of-view, clip planes, render buffer size, color depth, MSAA samples,
    perspective/orthographic projection, fog, conversion to monochrome and
    colour tinting
  - PBR forward-rendering pipeline with emissive objects, transparency and
    translucency, plus the ability to plug in custom GLSL shaders for arbitrary
    groups of objects
  - texture mapping, including with the output of other visual units (e.g., a
    drawing canvas or a video)
- simulating [physical particle
  systems](https://flitter.readthedocs.io/en/latest/physics.html), including
  spring/rod/rubber-band constraints, gravity, electrostatic charge, adhesion,
  buoyancy, inertia, drag (including in flowing media), Brownian motion,
  uniform electric fields, barriers and particle collisions
- [playing videos](https://flitter.readthedocs.io/en/latest/windows.html#video)
  at arbitrary speeds (including in reverse)
- running [GLSL
  shaders](https://flitter.readthedocs.io/en/latest/shaders.html) as
  stacked image filters and generators, with per-frame control of arbitrary
  uniforms, and support for multi-pass and downsampling
- built-in filters for: scaling/translating/rotating, Gaussian blurring, bloom,
  edge detection, vignetting, video feedback, lens flares, color and exposure
  adjustments, tone-mapping with the Reinhard and ACES Filmic functions, and 2D
  noise-map generation
- compositing all of the above and rendering to one or more windows
- [saving rendered
  output](https://flitter.readthedocs.io/en/latest/windows.html#record) to
  image and video files (including lockstep frame-by-frame video output
  suitable for producing perfect loops and direct generation of animated GIFs)
- taking live inputs from Ableton Push 2 or Behringer X-Touch mini MIDI
  surfaces (other controllers relatively easy to add)
- driving arbitrary DMX fixtures via an Entec-compatible USB DMX interface
- driving a LaserCube plugged in over USB (other lasers probably easy-ish to
  support)

**Flitter** also has a plug-in architecture that allows extension with new
image and 3D mesh generators, MIDI and DMX interfaces, or completely novel
input and output systems.

## Installation

**Flitter** can be installed from the [`flitter-lang` PyPI
package](https://pypi.org/project/flitter-lang/)  with:

```sh
pip3 install flitter-lang
```

and then run as:

```sh
flitter path/to/some/flitter/script.fl
```

More details can be found in the [installation
documentation](https://flitter.readthedocs.io/en/latest/install.html).

## Documentation

The documentation is available on [**Read** *the*
**Docs**](https://flitter.readthedocs.io/).

There are a few quick
[examples](https://github.com/jonathanhogg/flitter/blob/main/examples)
in the main repository. However, there is also a separate repo containing [many
more interesting examples](https://github.com/jonathanhogg/flitter-examples)
that are worth checking out.

## License

**Flitter** is copyright © Jonathan Hogg and licensed under a [2-clause
"simplified" BSD
license](https://github.com/jonathanhogg/flitter/blob/main/LICENSE)
except for the OpenSimplex 2S noise implementation, which is based on
[code](https://code.larus.se/lmas/opensimplex) copyright © A. Svensson and
licensed under an [MIT
license](https://code.larus.se/lmas/opensimplex/src/branch/master/LICENSE).
