Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. vector red = <1,0,0>;
  2. vector green = <0,1,0>;
  3. vector blue = <0,0,1>;
  4.  
  5. float rate = 0.05;
  6. float speed = 0.2;
  7. integer switch1 = 1;
  8. integer switch2 = 2;
  9. integer switch3 = 3;
  10. integer switch4 = 4;
  11. integer switch5 = 5;
  12. integer switch6 = 6;
  13. integer switch = -1;
  14. integer currentFade = 1;
  15.  
  16. vector ColorCube(vector currColor)
  17. {
  18. if (currColor.x < 0)
  19. currColor.x = 0;
  20. if (currColor.y < 0)
  21. currColor.y = 0;
  22. if (currColor.z < 0)
  23. currColor.z = 0;
  24.  
  25. // From red to yellow
  26. if ( currentFade == switch1 && currColor.y < 1.0 )
  27. return (currColor + <0,rate,0>);
  28. else if( currentFade == switch1 && currColor.y >= 1.0 )
  29. currentFade = switch2;
  30.  
  31.  
  32. // From yellow to green
  33. if ( currentFade == switch2 && currColor.x > 0.0 )
  34. return (currColor - <rate, 0, 0>);
  35. else if( currentFade == switch2 && currColor.x <= 0.0 )
  36. currentFade = switch3;
  37.  
  38.  
  39. // From green to blue/green
  40. if ( currentFade == switch3 && currColor.z < 1.0 )
  41. return (currColor + <0, 0, rate>);
  42. else if( currentFade == switch3 && currColor.z >= 1.0 )
  43. currentFade = switch4;
  44.  
  45. // From blue/green to blue
  46. if ( currentFade == switch4 && currColor.y > 0.0 )
  47. return (currColor - <0, rate, 0>);
  48. else if( currentFade == switch4 && currColor.y <= 0.0 )
  49. {
  50. currentFade = switch5;
  51. }
  52.  
  53. // From blue to purple
  54. if ( currentFade == switch5 && currColor.x < 1.0 )
  55. return (currColor + <rate, 0, 0>);
  56. else if( currentFade == switch5 && currColor.x >= 1.0)
  57. currentFade = switch6;
  58.  
  59. // From purple to red
  60. if ( currentFade == switch6 && currColor.z > 0.0 )
  61. return (currColor - <0, 0, rate>);
  62. else if( currentFade == switch6 && currColor.z <= 0.0 )
  63. currentFade = switch1;
  64.  
  65.  
  66.  
  67. return currColor;
  68.  
  69. }
  70.  
  71. default
  72. {
  73. state_entry()
  74. {
  75. llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES,2,2,0.0,4.0,6.0);
  76. }
  77. on_rez( integer param )
  78. {
  79. switch = 1;
  80. llSetColor( <1,0,0> , ALL_SIDES );
  81. llSetTimerEvent( speed );
  82. }
  83.  
  84.  
  85.  
  86. timer()
  87. {
  88. vector color = ColorCube(llGetColor(ALL_SIDES));
  89. llSetColor(color, ALL_SIDES);
  90. llSetPrimitiveParams([ PRIM_TEXTURE, 2, "d3eebe4a-5933-45dc-b257-957fe8b3db29", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 ]);
  91. llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POINT_LIGHT, TRUE, color, 1.0, 10.0, 0.5]);
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement