1.0.3 • Published 2 years ago

ccompass v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Ccompass

A library for simplify your life with HTML5 canvas, inspired in P5.js

Objetive

Ccompass reduces the boilerplate code when draw in canvas

without ccompass

// set up
const canvas = document.getElementById('canvas1')
const ctx = canvas.getContext('2d')

// draw
ctx.beginPath()
ctx.moveTo(20, 20)
ctx.lineTo(100, 20)
ctx.strokeStyle = 'tomato'
ctx.stroke()
ctx.closePath()

with ccompass

// set up
import Ccompass from 'ccompass'

const canvas = document.getElementById('canvas1')
const ctx = canvas.getContext('2d')
const draw = new Ccompass(ctx)

// draw
draw.stroke('tomato')
draw.line(20, 20, 100, 20)

Todos

Vector Method

  • Set
  • Add
  • Subtract
  • Set Magnitude
  • Multiply
  • Copy

Functions to add

  • Perling noice function
  • Lerp function
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago