mystify.ts 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. import type { Scene } from "./_helpers";
  2. export const mystify: Scene = {
  3. name: "Mystify",
  4. description:
  5. "Neon wireframe torus knots orbiting in the void -- the Windows Mystify screensaver in 3D",
  6. spec: {
  7. root: "scene",
  8. elements: {
  9. scene: {
  10. type: "Group",
  11. props: { position: null, rotation: null, scale: null },
  12. children: [
  13. "cam",
  14. "ambient",
  15. "shape1",
  16. "shape2",
  17. "shape3",
  18. "shape4",
  19. "shape5",
  20. "shape6",
  21. "shape7",
  22. "post",
  23. "controls",
  24. ],
  25. },
  26. cam: {
  27. type: "PerspectiveCamera",
  28. props: {
  29. position: [0, 0, 10],
  30. rotation: null,
  31. scale: null,
  32. fov: 55,
  33. near: 0.1,
  34. far: 1000,
  35. makeDefault: true,
  36. },
  37. children: [],
  38. },
  39. ambient: {
  40. type: "AmbientLight",
  41. props: { color: "#111111", intensity: 0.1 },
  42. children: [],
  43. },
  44. shape1: {
  45. type: "Orbit",
  46. props: {
  47. position: null,
  48. rotation: null,
  49. scale: null,
  50. speed: 0.5,
  51. radius: 3,
  52. tilt: 0.3,
  53. },
  54. children: ["s1-spin"],
  55. },
  56. "s1-spin": {
  57. type: "Spin",
  58. props: {
  59. position: null,
  60. rotation: null,
  61. scale: null,
  62. speed: 1.5,
  63. axis: "x",
  64. },
  65. children: ["s1-body"],
  66. },
  67. "s1-body": {
  68. type: "TorusKnot",
  69. props: {
  70. position: null,
  71. rotation: null,
  72. scale: null,
  73. castShadow: false,
  74. receiveShadow: false,
  75. radius: 0.4,
  76. tube: 0.02,
  77. p: 2,
  78. q: 3,
  79. tubularSegments: 128,
  80. radialSegments: 4,
  81. material: {
  82. color: "#00ffff",
  83. emissive: "#00ffff",
  84. emissiveIntensity: 2,
  85. wireframe: true,
  86. },
  87. },
  88. children: [],
  89. },
  90. shape2: {
  91. type: "Orbit",
  92. props: {
  93. position: null,
  94. rotation: null,
  95. scale: null,
  96. speed: -0.4,
  97. radius: 4,
  98. tilt: -0.5,
  99. },
  100. children: ["s2-spin"],
  101. },
  102. "s2-spin": {
  103. type: "Spin",
  104. props: {
  105. position: null,
  106. rotation: null,
  107. scale: null,
  108. speed: -1,
  109. axis: "z",
  110. },
  111. children: ["s2-body"],
  112. },
  113. "s2-body": {
  114. type: "Torus",
  115. props: {
  116. position: null,
  117. rotation: null,
  118. scale: null,
  119. castShadow: false,
  120. receiveShadow: false,
  121. radius: 0.6,
  122. tube: 0.015,
  123. radialSegments: 4,
  124. tubularSegments: 128,
  125. material: {
  126. color: "#ff00ff",
  127. emissive: "#ff00ff",
  128. emissiveIntensity: 2,
  129. wireframe: true,
  130. },
  131. },
  132. children: [],
  133. },
  134. shape3: {
  135. type: "Orbit",
  136. props: {
  137. position: null,
  138. rotation: null,
  139. scale: null,
  140. speed: 0.7,
  141. radius: 2.5,
  142. tilt: 0.8,
  143. },
  144. children: ["s3-spin"],
  145. },
  146. "s3-spin": {
  147. type: "Spin",
  148. props: {
  149. position: null,
  150. rotation: null,
  151. scale: null,
  152. speed: 2,
  153. axis: "y",
  154. },
  155. children: ["s3-body"],
  156. },
  157. "s3-body": {
  158. type: "TorusKnot",
  159. props: {
  160. position: null,
  161. rotation: null,
  162. scale: null,
  163. castShadow: false,
  164. receiveShadow: false,
  165. radius: 0.35,
  166. tube: 0.015,
  167. p: 3,
  168. q: 2,
  169. tubularSegments: 128,
  170. radialSegments: 4,
  171. material: {
  172. color: "#ffff00",
  173. emissive: "#ffff00",
  174. emissiveIntensity: 2,
  175. wireframe: true,
  176. },
  177. },
  178. children: [],
  179. },
  180. shape4: {
  181. type: "Orbit",
  182. props: {
  183. position: null,
  184. rotation: null,
  185. scale: null,
  186. speed: -0.6,
  187. radius: 3.5,
  188. tilt: -0.2,
  189. },
  190. children: ["s4-spin"],
  191. },
  192. "s4-spin": {
  193. type: "Spin",
  194. props: {
  195. position: null,
  196. rotation: null,
  197. scale: null,
  198. speed: 1.2,
  199. axis: "x",
  200. },
  201. children: ["s4-body"],
  202. },
  203. "s4-body": {
  204. type: "Torus",
  205. props: {
  206. position: null,
  207. rotation: null,
  208. scale: null,
  209. castShadow: false,
  210. receiveShadow: false,
  211. radius: 0.5,
  212. tube: 0.012,
  213. radialSegments: 4,
  214. tubularSegments: 128,
  215. material: {
  216. color: "#00ff44",
  217. emissive: "#00ff44",
  218. emissiveIntensity: 2,
  219. wireframe: true,
  220. },
  221. },
  222. children: [],
  223. },
  224. shape5: {
  225. type: "Orbit",
  226. props: {
  227. position: null,
  228. rotation: null,
  229. scale: null,
  230. speed: 0.3,
  231. radius: 5,
  232. tilt: 0.6,
  233. },
  234. children: ["s5-spin"],
  235. },
  236. "s5-spin": {
  237. type: "Spin",
  238. props: {
  239. position: null,
  240. rotation: null,
  241. scale: null,
  242. speed: -1.8,
  243. axis: "z",
  244. },
  245. children: ["s5-body"],
  246. },
  247. "s5-body": {
  248. type: "TorusKnot",
  249. props: {
  250. position: null,
  251. rotation: null,
  252. scale: null,
  253. castShadow: false,
  254. receiveShadow: false,
  255. radius: 0.5,
  256. tube: 0.018,
  257. p: 2,
  258. q: 5,
  259. tubularSegments: 128,
  260. radialSegments: 4,
  261. material: {
  262. color: "#ff4400",
  263. emissive: "#ff4400",
  264. emissiveIntensity: 2,
  265. wireframe: true,
  266. },
  267. },
  268. children: [],
  269. },
  270. shape6: {
  271. type: "Orbit",
  272. props: {
  273. position: null,
  274. rotation: null,
  275. scale: null,
  276. speed: -0.8,
  277. radius: 2,
  278. tilt: -0.7,
  279. },
  280. children: ["s6-spin"],
  281. },
  282. "s6-spin": {
  283. type: "Spin",
  284. props: {
  285. position: null,
  286. rotation: null,
  287. scale: null,
  288. speed: 2.5,
  289. axis: "y",
  290. },
  291. children: ["s6-body"],
  292. },
  293. "s6-body": {
  294. type: "Torus",
  295. props: {
  296. position: null,
  297. rotation: null,
  298. scale: null,
  299. castShadow: false,
  300. receiveShadow: false,
  301. radius: 0.3,
  302. tube: 0.01,
  303. radialSegments: 4,
  304. tubularSegments: 128,
  305. material: {
  306. color: "#4488ff",
  307. emissive: "#4488ff",
  308. emissiveIntensity: 2,
  309. wireframe: true,
  310. },
  311. },
  312. children: [],
  313. },
  314. shape7: {
  315. type: "Orbit",
  316. props: {
  317. position: null,
  318. rotation: null,
  319. scale: null,
  320. speed: 0.45,
  321. radius: 4.5,
  322. tilt: 1,
  323. },
  324. children: ["s7-spin"],
  325. },
  326. "s7-spin": {
  327. type: "Spin",
  328. props: {
  329. position: null,
  330. rotation: null,
  331. scale: null,
  332. speed: -0.8,
  333. axis: "x",
  334. },
  335. children: ["s7-body"],
  336. },
  337. "s7-body": {
  338. type: "TorusKnot",
  339. props: {
  340. position: null,
  341. rotation: null,
  342. scale: null,
  343. castShadow: false,
  344. receiveShadow: false,
  345. radius: 0.45,
  346. tube: 0.015,
  347. p: 3,
  348. q: 4,
  349. tubularSegments: 128,
  350. radialSegments: 4,
  351. material: {
  352. color: "#ff88ff",
  353. emissive: "#ff88ff",
  354. emissiveIntensity: 2,
  355. wireframe: true,
  356. },
  357. },
  358. children: [],
  359. },
  360. post: {
  361. type: "EffectComposer",
  362. props: { enabled: true, multisampling: 8 },
  363. children: ["bloom", "vignette"],
  364. },
  365. bloom: {
  366. type: "Bloom",
  367. props: {
  368. intensity: 3,
  369. luminanceThreshold: 0.05,
  370. luminanceSmoothing: 0.3,
  371. mipmapBlur: true,
  372. },
  373. children: [],
  374. },
  375. vignette: {
  376. type: "Vignette",
  377. props: { offset: 0.2, darkness: 0.8 },
  378. children: [],
  379. },
  380. controls: {
  381. type: "OrbitControls",
  382. props: {
  383. enableDamping: true,
  384. dampingFactor: null,
  385. enableZoom: true,
  386. enablePan: true,
  387. enableRotate: true,
  388. minDistance: 4,
  389. maxDistance: 18,
  390. minPolarAngle: null,
  391. maxPolarAngle: null,
  392. autoRotate: true,
  393. autoRotateSpeed: 0.3,
  394. },
  395. children: [],
  396. },
  397. },
  398. },
  399. };