Merge branch 'master' of git://factorcode.org/git/factor
commit
f99ab896f8
extra
cfdg/models/spirales
html/streams
|
@ -0,0 +1,41 @@
|
|||
|
||||
USING: namespaces sequences math random-weighted cfdg ;
|
||||
|
||||
IN: cfdg.models.spirales
|
||||
|
||||
DEFER: line
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
: block ( -- )
|
||||
[
|
||||
[ circle ] do
|
||||
[ 0.3 s 60 flip line ] do
|
||||
]
|
||||
recursive ;
|
||||
|
||||
: a1 ( -- )
|
||||
[
|
||||
[ 0.95 s 2 x 12 r 0.5 b 10 hue 1.5 sat a1 ] do
|
||||
[ block ] do
|
||||
]
|
||||
recursive ;
|
||||
|
||||
: line ( -- )
|
||||
-0.3 a
|
||||
[ 0 rotate a1 ] do
|
||||
[ 120 rotate a1 ] do
|
||||
[ 240 rotate a1 ] do ;
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
: run ( -- )
|
||||
[ -1 b ] >background
|
||||
{ -20 40 -20 40 } viewport set
|
||||
[ line ] >start-shape
|
||||
0.03 >threshold
|
||||
cfdg-window ;
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
MAIN: run
|
|
@ -0,0 +1 @@
|
|||
demos
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
USING: html.streams html.streams.private
|
||||
io io.streams.string io.styles kernel
|
||||
namespaces tools.test xml.writer sbufs sequences inspector ;
|
||||
io io.streams.string io.styles kernel
|
||||
namespaces tools.test xml.writer sbufs sequences inspector colors ;
|
||||
|
||||
IN: html.streams.tests
|
||||
|
||||
: make-html-string
|
||||
|
@ -52,7 +54,7 @@ M: funky browser-link-href
|
|||
[
|
||||
[
|
||||
"car"
|
||||
H{ { foreground { 1 0 1 1 } } }
|
||||
H{ { foreground T{ rgba f 1 0 1 1 } } }
|
||||
format
|
||||
] make-html-string
|
||||
] unit-test
|
||||
|
@ -60,7 +62,7 @@ M: funky browser-link-href
|
|||
[ "<div style='background-color: #ff00ff; white-space: pre; font-family: monospace; '>cdr</div>" ]
|
||||
[
|
||||
[
|
||||
H{ { page-color { 1 0 1 1 } } }
|
||||
H{ { page-color T{ rgba f 1 0 1 1 } } }
|
||||
[ "cdr" write ] with-nesting
|
||||
] make-html-string
|
||||
] unit-test
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: generic assocs help http io io.styles io.files continuations
|
||||
io.streams.string kernel math math.order math.parser namespaces
|
||||
quotations assocs sequences strings words html.elements
|
||||
xml.entities sbufs continuations destructors accessors ;
|
||||
|
||||
USING: combinators generic assocs help http io io.styles io.files
|
||||
continuations io.streams.string kernel math math.order math.parser
|
||||
namespaces quotations assocs sequences strings words html.elements
|
||||
xml.entities sbufs continuations destructors accessors arrays ;
|
||||
|
||||
IN: html.streams
|
||||
|
||||
GENERIC: browser-link-href ( presented -- href )
|
||||
|
@ -47,9 +49,9 @@ TUPLE: html-sub-stream < html-stream style parent ;
|
|||
] [ call ] if*
|
||||
] [ call ] if* ; inline
|
||||
|
||||
: hex-color, ( triplet -- )
|
||||
3 head-slice
|
||||
[ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ;
|
||||
: hex-color, ( color -- )
|
||||
{ [ red>> ] [ green>> ] [ blue>> ] } cleave 3array
|
||||
[ 255 * >fixnum >hex 2 CHAR: 0 pad-left % ] each ;
|
||||
|
||||
: fg-css, ( color -- )
|
||||
"color: #" % hex-color, "; " % ;
|
||||
|
|
Loading…
Reference in New Issue