-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
| canvas n r s1 particles s2 s3 |
canvas := RSCanvas new.
canvas clearBackground: false.
canvas color: Color black.
n := 600.
r := 75.
s1 := NSScale linear
domain: { 0. n };
range: { Float pi negated. Float pi }.
s2 := NSScale linear
domain: { r * 2. 0 };
range: {Float twoPi. Float pi}.
s3 := NSScale linear
domain: { r * 2. 0 };
range: { Float pi. Float twoPi }.
particles := OrderedCollection new.
(0 to: n-1) do: [ :i |
| theta p out alpha shape |
theta := s1 scale: i.
p := (theta cos @ theta sin) * r.
out := false.
shape := RSEllipse new
position: p;
size: 2.1;
color: (Color h: i/6 * 360 / 100 s: 1 v: i % 100 / 100);
yourself.
shape propertyAt: #update put: [
| d angle v |
d := p distanceTo: 0@0.
angle := p angle + (out
ifTrue: [ s2 scale: d ]
ifFalse: [ s3 scale: d ]).
v := angle cos @ angle sin .
p := p + v.
d > (r * 3 - 1)
ifTrue: [ out := false ]
ifFalse: [ d < (r +1) ifTrue: [ out := true ] ].
"shape color: (shape color alpha: alpha)."
shape position: p.
"alpha := 1."
].
particles add: shape.
].
canvas addAll: particles.
canvas newAnimation
repeat;
onStepDo: [ :t |
particles do: [ :p |
(p propertyAt: #update) value ].
].
canvas videoExporter
p480;
duration: 12 seconds;
export
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
