web

package
v0.0.0-...-bc8e4b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package web provides utilities for drawing a sierpinski triangle using html and javascript.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve()

Serve starts an http server which provides visualizations of a sierpinski triangle.

func WriteHTML

func WriteHTML(writer io.Writer, opts *RenderOpts) error

WriteHTML uses the given Triangle and RenderOpts to render an html template and write it to the given io.Writer.

func WriteJS

func WriteJS(writer io.Writer, opts *RenderOpts) error

WriteJS uses the given Triangle and RenderOpts to render a javascript template and write it to the given io.Writer.

func WriteJSON

func WriteJSON(writer io.Writer, opts *RenderOpts) error

WriteJSON uses the given Triangle and RenderOpts to render a JSON representation of the Triangle and write it to the given io.Writer.

Types

type RGB

type RGB struct {
	R int `json:"r"`
	G int `json:"g"`
	B int `json:"b"`
}

RGB represents a color used to draw a sierpinski triangle.

type RenderOpts

type RenderOpts struct {
	Chaos       *chaos.Triangle `json:"chaos"`
	PointRadius float64         `json:"point_radius"`
	PointColor  *RGB            `json:"point_color"`
}

RenderOpts represents the options available when rendering a sierpinski triangle.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL