きったんの頭

HOME > 数学

kg

JavaScriptの図形ライブラリ

kg.js
console

関数一覧

kg

ver
バージョン情報 alert(kg.ver)
date
最終更新日 alert(kg.date)
url
このページのURL alert(kg.url)
len()
長さ
(0,0), (1,1) を結ぶ線分の長さ:var l = new kg.line(0, 0, 1, 1); alert(kg.len(l));
s()
面積
半径1の円の面積:var c = new kg.circle(1); alert(kg.s(c));
ptol()
point から line つくる
ptor()
point から rect つくる
ptoc()
point から circle つくる
ptoe()
point から ellipse つくる

canvas

canvas(id, x, y, zoom, bgcolor)
図形描画用のcanvas
append(object)
objectをcanvasに描画

svg

svg(id, x, y, zoom, bgcolor)
図形描画用のSVG
append(object)
objectをSVGに描画

point

point(x, y, color)

line

line(x1, y1, x2, y2, color, lineWidth)
線分

rect

rect(x1, y1, x2, y2, color, lineColor, lineWidth)
長方形

circle

circle(r, x, y, color, lineColor, lineWidth)

ellipse

ellipse(rx, ry, x, y, color, lineColor, lineWidth)
楕円