Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[ALLY] ROTOBJECTS demo

From: cyphre::volny::cz at: 12-Apr-2001 12:30

Hello, Here is simple 1.5Kb script using DRAW dialect I did for /Link. This version is for all /View users too so enjoy it ;-) Regards, Cyphre REBOL [ Title: "2D engine" Date: 4-feb-2001 Version: 0.0.1 file: %2D-demo.r ] poly: func [p l r s /local i a b][ qd: copy [] for i 1 + r 360 + r 360 / s [ a: to-integer ((sine i) * l/1) + ((cosine i) * l/2) + p/1 b: to-integer ((sine i) * l/1) - ((cosine i) * l/2) + p/2 append qd to-pair reduce [a b] ] ] obj: func [ oft /local result ][ result: reduce [ make face [ c: random 360 rot: first random [-6 6] edge: none size: to-pair (random 80) + 30 offset: oft - (size / 2) color: black effect: [draw []] rate: 00:00:00.05 feel: make feel [ engage: func [f a e][ f/size: to-pair to-integer (f/c / 10) + 20 f/offset: to-pair reduce first random [[f/offset/1 + 2 f/offset/2] [f/offset/1 f/offset/2 - 2] [f/offset/1 - 2 f/offset/2] [f/offset/1 f/offset/2 + 2]] f/c: f/c + f/rot if any [f/c > 360 f/c < 1] [f/rot: negate f/rot] poly f/size / 2 f/size / pi f/c to-integer ((f/c / 60) + 3) f/effect: compose/deep [draw [ pen white polygon (qd) fill-pen (random 255.255.255) flood (f/size / pi) ] key 0.0.0 ] show f ] ] ]] return result ] view layout [ backdrop with [effect: [gradient 0x1 0.20.40 60.80.150]] vtext "SIMPLE 2D OBJECT DEMO by Cyphre in 2001" vtext "try to ^"paint^" on BLACK FACE and enjoy it :)" box 640x400 black with [pane: [] edge: make edge [size: 2x2 color: 128.128.128 effect: 'ibevel] feel: make feel [ engage: func [f a e][ if find [down over] a [ append f/pane obj e/offset show f ] ] ] ] ]