Skip to content

Commit 03f0e35

Browse files
committed
Add lights
1 parent 4a9706e commit 03f0e35

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

sites/docs/src/home/stage.js

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function Stage({ children, deck }) {
2929
if (!vw) return null;
3030
const h = Math.max((vw / vh < 1.16 ? vw / 1.16 : vh) * 0.75, 330);
3131
const scale = h * 0.2;
32-
const yMiddle = 0.33;
32+
const yMiddle = 0.28;
3333
const yOrigin = (0.6 * h) / vh;
3434
return (
3535
<div
@@ -107,12 +107,16 @@ export default function Stage({ children, deck }) {
107107

108108
function StageObjects({ sceneWidth, sceneHeight, yMiddle, deck }) {
109109
const startZ = -4;
110+
const [lightsOn, setLightsOn] = React.useState(false);
110111
return (
111112
<React.Fragment>
113+
{lightsOn && <Lights />}
112114
<Move dz={startZ - 4}>
113-
<Screen deck={deck} />
115+
<NoLights>
116+
<Screen deck={deck} />
117+
</NoLights>
114118
</Move>
115-
<Move dz={startZ - 3} dy={-3}>
119+
<Move dz={startZ - 3} dy={-2.7}>
116120
<Top />
117121
</Move>
118122
{sceneWidth > 7 && (
@@ -130,16 +134,18 @@ function StageObjects({ sceneWidth, sceneHeight, yMiddle, deck }) {
130134
</React.Fragment>
131135
)}
132136
<Move dy={3.2} dx={2} dz={startZ - 1}>
133-
<Pulpit />
137+
<Pulpit onClick={() => setLightsOn(on => !on)} />
134138
</Move>
135139
<Move dy={3.1} dz={startZ}>
136140
<Platform />
137141
</Move>
138-
<Divider
139-
sceneWidth={sceneWidth}
140-
sceneHeight={sceneHeight}
141-
yMiddle={yMiddle}
142-
/>
142+
<NoLights>
143+
<Divider
144+
sceneWidth={sceneWidth}
145+
sceneHeight={sceneHeight}
146+
yMiddle={yMiddle}
147+
/>
148+
</NoLights>
143149
</React.Fragment>
144150
);
145151
}
@@ -219,7 +225,7 @@ function Platform() {
219225
);
220226
}
221227

222-
function Pulpit() {
228+
function Pulpit({ onClick }) {
223229
const w = 0.5;
224230
const h = 0.9;
225231
const scale = useScale();
@@ -233,9 +239,12 @@ function Pulpit() {
233239
color: "#FFF8",
234240
textAlign: "center",
235241
fontFamily: "monospace",
236-
backgroundImage: `url("${purtyWood}")`
242+
backgroundImage: `url("${purtyWood}")`,
243+
userSelect: "none",
244+
cursor: "pointer"
237245
}}
238246
pinY={"bottom"}
247+
onClick={onClick}
239248
>
240249
<div style={{ fontSize: scale * 0.2, paddingTop: "40%" }}>RAD</div>
241250
<div style={{ fontSize: scale * 0.15 }}>CONF</div>
@@ -288,3 +297,21 @@ function Divider({ sceneWidth, sceneHeight, yMiddle }) {
288297
/>
289298
);
290299
}
300+
301+
function Lights() {
302+
const orange = "#f9bc00";
303+
const blue = "#539ed8";
304+
const pink = "#c30083";
305+
return (
306+
<React.Fragment>
307+
<PointLight color="#333" z={10} />
308+
<SpotLight y={-5} color={blue} z={-2} toZ={-4} toX={-0.5} x={-2} />
309+
<SpotLight y={-5} color={blue} z={-2} toZ={-4} toX={2} x={-2} />
310+
<SpotLight y={-5} color={orange} z={-2} toZ={-4} toX={1} x={0} />
311+
<SpotLight y={-5} color={orange} z={-2} toZ={-4} toX={-1} x={-1.5} />
312+
<SpotLight y={-5} color={pink} z={-2} toZ={-4} toX={2.5} x={2} />
313+
<SpotLight color={pink} x={-5} y={4} z={-5} toX={-5} toY={2} toZ={-6} />
314+
<SpotLight color={pink} x={5} y={4} z={-5} toX={5} toY={2} toZ={-6} />
315+
</React.Fragment>
316+
);
317+
}

0 commit comments

Comments
 (0)