• Stars
    star
    258
  • Rank 158,189 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 1 year ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Self-contained WebGL flexbox layout engine

red-otter

Self-contained WebGL flexbox layout engine.

Documentation

See https://red-otter.dev.

Install

yarn add red-otter

To render text you will also need to generate the font atlas. See guide.

For editor to correctly highlight TypeScript code, add to compilerOptions in tsconfig.json:

{
  "jsx": "react-jsx",
  "jsxImportSource": "red-otter/dist"
}

Usage

import { Font, Context, Layout } from "red-otter";

const canvas = document.getElementById("app");

const font = new Font({
  spacingMetadataJsonURL: "/spacing.json",
  spacingBinaryURL: "/spacing.dat",
  UVBinaryURL: "/uv.dat",
  fontAtlasTextureURL: "/font-atlas.png",
});
await font.load();

const context = new Context(canvas, font);
context.clear();

const layout = new Layout(context);
layout.add(
  <view style={{ width: 100, height: 100, backgroundColor: "#fff" }}>
    <text style={{ fontFamily: font, fontSize: 20, color: "#000" }}>Hello</text>
  </view>
);

layout.render();
context.flush();

More Repositories

1

markdown-links

Command that displays a graph of local links between markdown files
TypeScript
245
star
2

nested-dnd

Proof of concept for doing a nested drag and drop in React
TypeScript
60
star
3

2d-opengl-rendering

Minimal, fast OpenGL renderer for 2D sprites
C++
51
star
4

tonfisk

TypeScript
36
star
5

triangolatte

2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs.
Go
36
star
6

baked-room

JavaScript
28
star
7

webgl-maps

WebGL map renderer written from scratch
TypeScript
20
star
8

remini

Mini React implementation made for fun and practice. Please do not use in production.
TypeScript
17
star
9

tangram

Example of using CSS animations triggered in JS.
TypeScript
11
star
10

pbr-webgpu

PBR IBL renderer in WebGPU
TypeScript
11
star
11

infinite-scribbles

Simple handwritten notes web editor with infinite canvas. Made with graphics tablets in mind. 🚧 WIP 🚧
TypeScript
7
star
12

topojson-osm-fetch

Utility for extracting OSM map data and converting it to TopoJSON
JavaScript
7
star
13

ttf-spacing

TTF parser for extracting letter spacing information
TypeScript
5
star
14

mini-md

Tiny Markdown editor with preview and prettier functionality
JavaScript
5
star
15

schedule_planner

Student schedule viewer
Python
4
star
16

lambda-chat

Simple chat using websockets.
Haskell
3
star
17

deck

Deck of cards made using CSS
TypeScript
3
star
18

comf

C++ 14 OpenGL Mini Framework
C++
3
star
19

prism-github-theme

CSS
2
star
20

fem-lshape

Jupyter Notebook solving FEM L-Shape problem
Jupyter Notebook
2
star
21

gatsby-react-docs-example

Example of documentation site with Gatsby autogenerated from components
TypeScript
2
star
22

drive-editor

Simple text editor storing all files on Google Drive
TypeScript
2
star
23

expo-qr-code-reader

Expo QR code reader
JavaScript
2
star
24

zoom-scribbling

TypeScript
2
star
25

bundling-ve

TypeScript
1
star
26

bio-updater

Update Twitter and GitHub go at one go.
JavaScript
1
star
27

backup-likes

TypeScript
1
star
28

agh-polish-legal-docs-parser

OOP class assignment. Parser which turns text file with legal document (following Act of rules for legislative techniques in Poland) into object form.
Java
1
star
29

webgl-triangulation

WebGL renderer for TopoJSON files
JavaScript
1
star
30

chess

TypeScript
1
star