Skip to content

Commit a45ffcf

Browse files
committed
galaxy test
1 parent 6a3bd55 commit a45ffcf

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

galaxy.red

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Red []
2+
3+
#include %animate.red
4+
5+
bleach: func [x] [white * 0.7 + (x * 0.3)]
6+
rotation: func [dir spd] [
7+
;; to rotate tangentially I need coordinate pair :(
8+
;; have to randomly choose constants until something almost works
9+
reduce [dir - 1.5 spd * 0.9975]
10+
]
11+
sc: 1.0
12+
pspec: compose/deep [
13+
number: 1000
14+
; emitter: [-5x-5 5x5]
15+
emitter: [-25x-400 25x-300]
16+
speed: 50.0
17+
speed-rnd: 0
18+
direction: 180
19+
shapes: [
20+
[pen (bleach red ) scale 0.5 0.5 [rotate (random 90) [line -2x0 2x0 line 0x-2 0x2]]]
21+
[pen (bleach blue ) scale 0.5 0.5 [rotate (random 90) [line -2x0 2x0 line 0x-2 0x2]]]
22+
[pen (bleach green ) scale 0.5 0.5 [rotate (random 90) [line -2x0 2x0 line 0x-2 0x2]]]
23+
[pen (bleach yellow ) scale 0.5 0.5 [rotate (random 90) [line -2x0 2x0 line 0x-2 0x2]]]
24+
[pen (bleach cyan ) scale 0.5 0.5 [rotate (random 90) [line -2x0 2x0 line 0x-2 0x2]]]
25+
[pen (bleach magenta) scale 0.5 0.5 [rotate (random 90) [line -2x0 2x0 line 0x-2 0x2]]]
26+
[pen (bleach white ) scale 0.5 0.5 [rotate (random 90) [line -2x0 2x0 line 0x-2 0x2]]]
27+
]
28+
limits: [
29+
case [
30+
within? as-pair x y -1000x-400 2000x120 [1 < random 1.2]
31+
50 > d: distance? 0x-130 as-pair x y [0.5 ** d > random 1.0]
32+
]
33+
]
34+
; new-coords: [x: (-10 + random 20) / sc: sc / 1.001 y: (-200 + random 50) / sc]
35+
new-coords: [x: -10 + random 50 y: -350 + random 50]
36+
forces: [rotation]
37+
; forces: [drag2 rotation]
38+
]
39+
view compose/deep/only [
40+
base 500x400 black rate 34 on-create [
41+
animate [
42+
translate 250x280
43+
; start 0 duration 600 ease :ease-linear loop forever
44+
; translate 250x250 ;rotate from 0.0 to -360.0
45+
;; start -60 - would need to emulate past events to fill this
46+
start -60 duration 600 ease :ease-out-expo
47+
; scale from 0.1 to 0 from 0.1 to 0
48+
; scale from 1.0 to 0.0 from 1.0 to 0.0
49+
particles wtf-is-this-for? pspec
50+
] face
51+
]
52+
]

0 commit comments

Comments
 (0)