Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v1 source pure

Package ebru is a Sinopia engine: Turkish paper marbling, computed. Paint drops are laid on a bath and every drop pus...

Overview

Package ebru is a Sinopia engine: Turkish paper marbling, computed. Paint drops are laid on a bath and every drop pushes the boundaries already floating outwards while keeping their area (P' = C + (P - C) * sqrt(1 + r^2 / |P - C|^2)); styluses and combs then drag the paint. The pattern types are the real ebru styles (Battal, Gelgit, Taraklı, Şal, Hatip, Bülbül Yuvası, Çiçekli), drawn originally.

It is a port of the Ebru prototype in the engine gallery (JavaScript), redesigned for the on-chain gas budget: a drop's stretch comes from a 1,024-entry table instead of two square roots per point, combs are one pass over a precomputed displacement table, points beyond the margin are pruned in runs and a point budget bounds the work and the output. frontend/src/engines/ebru.ts is a byte-identical TypeScript twin; ebru_test.gno and ebru.test.ts pin the same golden vectors.

Pure integer maths: no floats, no time, no block data.

Constants 3

const DefaultParams

1const DefaultParams = `{"pattern":"Seeded","palette":"Seeded"}`
source

DefaultParams is the canonical form of the defaults; it renders exactly like "".

const MaxSVGBytes

1const MaxSVGBytes = 28672
source

MaxSVGBytes bounds the output (the point budget keeps it far below).

const ParamsSchema

1const ParamsSchema = `{"type":"object","properties":{` +
2	`"pattern":{"type":"string","title":"Pattern","enum":["Seeded","Battal","Gelgit","Taraklı","Şal","Hatip",` +
3	`"Bülbül Yuvası","Çiçekli"],"default":"Seeded"},` +
4	`"palette":{"type":"string","title":"Palette","enum":["Seeded","Lahore & Ochre","Spring","Night","Earth","Sea",` +
5	`"Soot & Gold","Sinopia"],"default":"Seeded"}}}`
source

ParamsSchema is the Studio form. Studio sends JSON.stringify of the values in this property order; ValidateParams accepts exactly that or "".

Functions 8

func Manifest

1func Manifest() engine.Manifest
source

Manifest describes the engine. Author and FeeBps are set by the adapter.

func Render

1func Render(in engine.Input) string
source

Render returns the raw SVG for in.Seed and in.Params.

func SVG

1func SVG(seed string, cfg Config) string
source

SVG renders seed under cfg.

func Traits

1func Traits(in engine.Input) []engine.Trait
source

Traits returns the eight traits of in.Seed in TraitTypes order. It never renders: seven table draws.

func ValidateParams

1func ValidateParams(params string) error
source

ValidateParams accepts "" (the showcase defaults) and the canonical JSON.

func Defaults

1func Defaults() Config
source

Defaults is the showcase look (params "").

func ParseParams

1func ParseParams(params string) (Config, error)
source

ParseParams accepts "" or the canonical JSON Studio produces, nothing else.

func TraitsOf

1func TraitsOf(seed string, cfg Config) TraitSet
source

TraitsOf returns the traits for seed under cfg.

Types 2

type Config

struct
1type Config struct {
2	Pattern int // -1: drawn from the seed, else an index into the patterns
3	Palette int // -1: drawn from the seed, else an index into the palettes
4}
source

Config is a parsed params string.

type TraitSet

struct
1type TraitSet struct {
2	Pattern, Palette, Ground, Stones, Flow, Finish, Frame, Rarity string
3}
source

TraitSet is one token's traits by name.

Dependencies

Source Files 2