index.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * Copyright (c) 2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { PluginBehavior } from '../../mol-plugin/behavior/behavior';
  7. import { PluginConfig } from '../../mol-plugin/config';
  8. import { Color } from '../../mol-util/color/color';
  9. // from https://visualsonline.cancer.gov/details.cfm?imageid=2304, public domain
  10. import image_cells from './images/cells.jpg';
  11. // created with http://alexcpeterson.com/spacescape/
  12. import face_nebula_nx from './skyboxes/nebula/nebula_left2.jpg';
  13. import face_nebula_ny from './skyboxes/nebula/nebula_bottom4.jpg';
  14. import face_nebula_nz from './skyboxes/nebula/nebula_back6.jpg';
  15. import face_nebula_px from './skyboxes/nebula/nebula_right1.jpg';
  16. import face_nebula_py from './skyboxes/nebula/nebula_top3.jpg';
  17. import face_nebula_pz from './skyboxes/nebula/nebula_front5.jpg';
  18. export const Backgrounds = PluginBehavior.create<{ }>({
  19. name: 'extension-backgrounds',
  20. category: 'misc',
  21. display: {
  22. name: 'Backgrounds'
  23. },
  24. ctor: class extends PluginBehavior.Handler<{ }> {
  25. register(): void {
  26. this.ctx.config.set(PluginConfig.Background.Styles, [
  27. [{
  28. variant: {
  29. name: 'radialGradient',
  30. params: {
  31. centerColor: Color(0xFFFFFF),
  32. edgeColor: Color(0x808080),
  33. ratio: 0.2,
  34. coverage: 'viewport',
  35. }
  36. }
  37. }, 'Light Radial Gradient'],
  38. [{
  39. variant: {
  40. name: 'image',
  41. params: {
  42. source: {
  43. name: 'url',
  44. params: image_cells
  45. },
  46. lightness: 0,
  47. saturation: 0,
  48. opacity: 1,
  49. coverage: 'viewport',
  50. }
  51. }
  52. }, 'Normal Cells Image'],
  53. [{
  54. variant: {
  55. name: 'skybox',
  56. params: {
  57. faces: {
  58. name: 'urls',
  59. params: {
  60. nx: face_nebula_nx,
  61. ny: face_nebula_ny,
  62. nz: face_nebula_nz,
  63. px: face_nebula_px,
  64. py: face_nebula_py,
  65. pz: face_nebula_pz,
  66. }
  67. },
  68. lightness: 0,
  69. saturation: 0,
  70. opacity: 1,
  71. }
  72. }
  73. }, 'Purple Nebula Skybox'],
  74. ]);
  75. }
  76. update() {
  77. return false;
  78. }
  79. unregister() {
  80. this.ctx.config.set(PluginConfig.Background.Styles, []);
  81. }
  82. },
  83. params: () => ({ })
  84. });