-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
canvas := RSCanvas new.
canvas color: Color black.
polygons := OrderedCollection new.
radius := 18.
altitude := 3 sqrt * radius.
total := 18.
cos := (1/3 * Float pi) cos.
svg := RSSVGPath new.
path := ''.
hex := [
| points |
points := (0 to: Float twoPi by: Float twoPi / 6) allButLast
collect: [ :a | (a sin@a cos) * radius ].
RSPolygon new
points: points;
yourself.
].
(total negated to: total) do: [ :x |
| y1 y2 |
y1 := total negated max: x negated - total.
y2 := total min: total - x.
(y1 to: y2) do: [ :y |
| xx yy poly pts |
xx := (x * altitude) + (cos * y * altitude).
yy := y * radius * 1.5.
poly := (hex value position: xx @ yy).
polygons add: poly.
pts := poly points collect: [ :pt | pt + poly position ].
path := path , 'M ', pts first x asString, ' ', pts first y asString.
pts allButFirst do: [ :pt | path := path , ' L ', pt x asString, ' ', pt y asString ].
path := path , ' Z '.
]
].
svg svgPath: path.
paint := LinearGradientPaint fromArray: {
0 -> Color transparent.
0.5 -> Color blue translucent.
1 -> Color transparent }.
paint start: svg extent / -2.0; stop: svg extent / 2.0.
svg noPaint; border: (RSBorder new width: 3; color: paint).
canvas newAnimation
repeat;
duration: 4 seconds;
onStepDo: [ :t | paint colorRamp at: 2 put: t->Color blue translucent ].
canvas addAll: polygons.
canvas add: svg.
mouseX := 600.
canvas when: RSMouseMove do: [ :evt | mouseX := evt position x ].
update := [ :t |
polygons do: [ :p |
| angle distance satu |
angle := (p position transposed angle + t) / Float twoPi.
distance := 1- (p position r/ (altitude * total)).
satu := mouseX abs / canvas extent x.
p color: (Color h: angle * 360 s: satu v: distance*0.95+ 0.05)
].
canvas signalUpdate ].
canvas newAnimation
loops: 7;
easing: RSEasing backOut;
from: 0; to: Float twoPi;
duration: 2 seconds;
onStepDo: update.
(canvas animationFrom: {
canvas transitionAnimation
easing: RSEasing backOut;
duration: 900 milliSeconds;
from: Float twoPi; to: 0;
onStepDo: update.
canvas transitionAnimation
easing: RSEasing backOut;
from: 0; to: Float twoPi;
duration: 900 milliSeconds;
onStepDo: update.
}) repeat; delay: 14 seconds.
"(SampledSound soundNamed: 'getaway') play."
canvas @ RSCanvasController.
canvas open
setLabel: 'Getaway HEX';
extent: 1280@720.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
