A Picture Language (from
SICP 2.2.4
)
Code:
sample 1
sample 2
sample 3
sample 4
draw (ctrl+enter)
This browser doesn't support 'canvas'. Look on other browser, or install '
excanvas.js
'.
Sample painters
%line
%box
%circle
%image
Functions
Primitive draw functions
($line v0 v1 ...)
Each vn is vector (x . y).
($poly v0 v1 ...)
Each vn is vector (x . y).
($transform-image orig-x orig-y edge1-x edge1-y edge2-x edge2-y)
($color r g b &optional a)
[0 <= r,g,b <= 255], [0 <= a <= 1]
($save-ctx)
Save context ($color).
($restore-ctx)
Restore context.
Vector: (make-vect x y), (xcor-vect v), (ycor-vect v), (add-vect v1 v2), (sub-vect v1 v2), (scale-vect s v), (rot-vect v rad)
Segment: (make-segment v1 v2), (start-segment seg), (end-segment seg)
Frame: (make-frame origin edge1 edge2), (origin-frame frame), (edge1-frame frame), (edge2-frame frame), (frame-coord-map frame)
Misc: (draw-line v0 v1)
Source:
github:demo/pictlang.html
Author:
mokehehe
Powered by
BiwaScheme