Advertisement
Guest User

Blade style templates syntax

a guest
Sep 29th, 2022
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.77 KB | None | 0 0
  1. 1. TEMPLATES SYNTAX SUMMARY:

  2. 2. A compiled list of (mostly) all the style and transition templates in one place for easy reference.

  3. 3.  

  4. 4. As of ProffieOS 2.8:

  5. 5.  

  6. 6. Bump<BUMP_POSITION, BUMP_WIDTH_FRACTION>

  7. 7.         // Returns different values for each LED, forming a bump shape.

  8. 8.         // If BUMP_POSITION is 0, bump will be at the hilt.

  9. 9.         // If BUMP_POSITION is 32768, the bump will be at the tip.

  10. 10.         // If BUMP_WIDTH_FRACTION is 1, bump will be extremely narrow.

  11. 11.         // If BUMP_WIDTH_FRACTION is 32768, it will fill up most/all of the blade.

  12. 12.         // BUMP_POSITION, BUMP_WIDTH_FRACTION: INTEGER

  13. 13. ChangeSlowly<F, SPEED>

  14. 14.         // Changes F by no more than SPEED values per second.

  15. 15.         // F, SPEED: INTEGER

  16. 16.         // return value: INTEGER, same for all LEDs

  17. 17. Ifon<A, B>

  18. 18.         // Returns A if saber is on, B otherwise.

  19. 19.         // A, B: INTEGER

  20. 20.         // return value: INTEGER

  21. 21. InOutFunc<OUT_MILLIS, IN_MILLIS>

  22. 22.         // IN_MILLIS, OUT_MILLIS: a number

  23. 23.         // RETURN VALUE: FUNCTION

  24. 24.         // 0 when off, 32768 when on, takes OUT_MILLIS to go from 0 to 32768

  25. 25.         // takes IN_MILLIS to go from 32768 to 0.

  26. 26. Int<N>

  27. 27.         // Returns N

  28. 28.         // N: a number

  29. 29.         // return value: INTEGER

  30. 30. Scale<F, A, B>

  31. 31.         // Changes values in range 0 - 32768 to A-B

  32. 32.         // F, A, B: INTEGER

  33. 33.         // return value: INTEGER

  34. 34. Sin<RPM, LOW, HIGH>

  35. 35.         // pulses between LOW - HIGH RPM times per minute

  36. 36.         // LOW: INTEGER (defaults to Int<0>)

  37. 37.         // HIGH: INTEGER (defaults to Int<32768>)

  38. 38.         // RPM: INTEGER

  39. 39.         // return value: INTEGER

  40. 40.  

  41. 41.  

  42. 42. Trigger<EFFECT, FADE_IN_MILLIS, SUSTAIN_MILLIS, FADE_OUT_MILLIS>

  43. 43.         // Normally returns 0, but when EFFECT occurs, it ramps up to 32768,

  44. 44.         // stays there for SUSTAIN_MILLIS, then fades down to zero again.

  45. 45.         // EFFECT: BladeEffectType

  46. 46.         // FADE_IN_MILLIS: INTEGER

  47. 47.         // SUSTAIN_MILLIS: INTEGER

  48. 48.         // FADE_OUT_MILLIS: INTEGER

  49. 49.         // return value: INTEGER

  50. 50.  

  51. 51. —STYLES—

  52. 52.  

  53. 53. AudioFlicker<colorA, colorB>

  54. 54.         // blade modulated by current sound

  55. 55. Blast<BASE, BLAST_COLOR, FADEOUT_MS(150), WAVE_SIZE(100), WAVE_MS(400)>

  56. 56.         // blast with wave effect

  57. 57. BlastFadeout<BASE, BLAST_COLOR, FADEOUT_MS>

  58. 58.         // blast without wave effect, just like a full blade clash

  59. 59. Blinking<colorA, colorB, BLINK_MILLIS, BLINK_PROMILLE(500)>

  60. 60.         or: BlinkingX<colorA,colorB, BLINK_MILLIS_FUNC, BLINK_PROMILLE_FUNC>

  61. 61. BrownNoiseFlicker<colorA, colorB, GRADE>

  62. 62.     // Usage: BrownNoiseFlicker<A, B

  63. 63.     // A, B: COLOR

  64. 64.     // return value: COLOR

  65. 65.     // Randomly selects between A and B, but keeps nearby

  66. 66.     // pixels looking similar.

  67. 67. ByteOrderStyle<BYTEORDER, COLOR>

  68. 68.     // BYTEORDER: Color8::RGB, or one of the other byte orders

  69. 69.     // COLOR: COLOR

  70. 70.     // return value: COLOR

  71. 71.     // This shuffles the RGB values around. It's meant to be used

  72. 72.     // when you are mixing different kind of pixels on one string.

  73. 73.     // While it's not recommended to do so, this should make it

  74. 74.     // easier to compensate by re-ordering the channels.SimpleClash<BASE, CLASH_COLOR, CLASH_MILLIS>

  75. 75. &style_charging

  76. 76.     // return value: POINTER

  77. 77.     // Charging blade style.

  78. 78.     // Slowly pulsating battery indicator.

  79. 79.  

  80. 80. ColorCycle<COLOR, PERCENT, RPM>

  81. 81.         or: ColorCycle<COLOR, PERCENT, RPM, ON_COLOR, ON_PERCENT, ON_RPM, FADE_TIME_MILLIS>

  82. 82.     // or: ColorCycle<COLOR, PERCENT, RPM, ON_COLOR, ON_PERCENT, ON_RPM, FADE_TIME_MILLIS>

  83. 83.     // COLOR, ON_COLOR: COLOR

  84. 84.     // RPM, PERCENT, ON_PERCENT, ON_RPM, FADE_TIME_MILLIS: a number

  85. 85.     // return value: COLOR

  86. 86.     // This is intended for a small ring of neopixels

  87. 87.     // A section of the ring is lit at the specified color

  88. 88.     // and rotates at the specified speed. The size of the

  89. 89.     // lit up section is defined by "percentage".

  90. 90. ColorSequence<MILLIS_PER_COLOR, COLOR1, COLOR2, ….>

  91. 91.  

  92. 92. Cylon<COLOR, PERCENT, RPM>

  93. 93.      or: ColorCycle<COLOR, PERCENT, RPM, ON_COLOR, ON_PERCENT, ON_RPM, FADE_TIME_MILLIS>

  94. 94.     // COLOR, ON_COLOR: COLOR

  95. 95.     // RPM, PERCENT, ON_PERCENT, ON_RPM, FADE_TIME_MILLIS: a number

  96. 96.     // return value: COLOR

  97. 97.     // Cylon/Knight Rider effect, a section of the strip is

  98. 98.     // lit up and moves back and forth. Speed, color and fraction

  99. 99.     // illuminated can be configured separately for on and off

  100. 100.     // states.

  101. 101. Gradient<colorA, colorB>

  102. 102.         or: Gradient<colorA, colorB, colorC, …>

  103. 103. HumpFlicker<colorA, colorB, HUMP_WIDTH>

  104. 104. IgnitionDelay<DELAY_MILLIS, BASE>

  105. 105. InOutHelperX<BASE, EXTENSION, RETRACTION,OFF_COLOR>

  106. 106. InOutSparkTip<BASE, OUT_MILLIS, IN_MILLIS, SPARK_COLOR>

  107. 107. LocalizedClash<Base, Clash_color, LENGTH_MILLIS, BLADE_PERCENTAGE>

  108. 108. Lockup<BASE, LOCKUP_COLOR, DRAG_COLOR>

  109. 109. Mix<colorA, colorB, F>

  110. 110.         // mix between A and B using function F.

  111. 111.         // F = 0 -> return A, F = 16384 -> return (A+B)/2, F = 32768 -> return B

  112. 112. OnSpark<BASE, SPARK_COLOR, MILLIS>

  113. 113. OriginalBlast<BASE, BLAST_COLOR>

  114. 114.         // Blast with wave, but wave has BrownNoiseFlicker

  115. 115. Pulsing<colorA, colorB, PULSE_MILLIS>

  116. 116.         or: Pulsing<colorA, colorB, PULSE_MILLIS_FUNC>

  117. 117. RandomBlink<MILLIHZ, COLOR1, COLOR2>

  118. 118.         or: RandomBlinkX<MILLIHZ_CLASS, COLOR1, COLOR2>

  119. 119. RandomFlicker<colorA, colorB>

  120. 120. RandomPerLEDFlicker<colorA, colorB>

  121. 121. RgbCycle (no arguments)

  122. 122.         // return value: COLOR

  123. 123.         // Very fast Red, Green, Blue cycle, result should essentially be white

  124. 124.         // until you start swinging it around.

  125. 125. Rgb<R, G, B>

  126. 126.         return value: COLOR

  127. 127. Sequence<COLOR1, COLOR2, int millis_per_bits, int bits, 0b0000000000000000, ....>

  128. 128. SimpleClash<BASE, CLASH_COLOR, CLASH_MILLIS>

  129. 129.     // BASE: COLOR

  130. 130.     // CLASH_COLOR: COLOR (defaults to white)

  131. 131.     // CLASH_MILLIS: a number (defaults to 40)

  132. 132.     // return value: COLOR

  133. 133.     // Turns the blade to CLASH_COLOR for CLASH_MILLIS millseconds

  134. 134.     // when a clash occurs.

  135. 135. Sparkle<BASE, SPARKLE_COLOR, SPARK_CHANCE_PROMILLE, SPARK_INTENSITY>

  136. 136. Stripes<WIDTH, SPEED, COLOR1, COLOR2, ... >

  137. 137. Strobe<BASE, STROBE_COLOR, STROBE_FREQUENCY, STROBE_MILLIS>

  138. 138.         or: StrobeX<BASE, STROBE_COLOR, STROBE_FREQUENCY_FUNC, STROBE_MILLIS_FUNC>

  139. 139. StylePtr<BLADE>

  140. 140.         // blade style gets wrapped in this class

  141. 141.  

  142. 142.  

  143. 143. As of ProffieOS 3.6 BETA:

  144. 144.  

  145. 145. —STYLES—

  146. 146.  

  147. 147. RetractionDelay<DELAY_MILLIS, BASE>

  148. 148. ColorChange<TRANSITION, COLORS>

  149. 149. RotateColorsX<ROTATION, COLOR>

  150. 150.         // ROTATION specifies how much to rotate the color in HSV (color wheel) space.

  151. 151.         //  0 = none, 32768 = 360degrees

  152. 152. TransitionEffect<COLOR, EFFECT_COLOR, TRANSITION1, TRANSITION2, EFFECT>

  153. 153.     // COLOR, EFFECT_COLOR: COLOR

  154. 154.     // TRANSITION1, TRANSITION2 : TRANSITION

  155. 155.     // EFFECT: effect type

  156. 156.     // return value: COLOR

  157. 157.     // When the specified EFFECT happens (clash/blast/etc.) transition from COLOR to

  158. 158.     // EFFECT_COLOR using TRANSITION1. Then transition back using TRANSITION2.

  159. 159.  

  160. 160. TransitionLoop<COLOR, TRANSITION>

  161. 161.         // Continuously transitions COLOR to COLOR

  162. 162.         // Makes more sense if TRANSITION is a TrConcat, as this will

  163. 163.         // transition to/from the intermediate steps in a loop.

  164. 164.  

  165. 165. —TRANSITIONS— (Insert these where it says TRANSITION in a template) (Not sure about how to integrate Functions)

  166. 166.  

  167. 167. InOutTr<BASE, OUT_TRANSITION, IN_TRANSITION, OFF_COLOR>

  168. 168.         // Similar to InOutHelper<>, but uses configurable transitions

  169. 169.         // to go to and from the BASE to the OFF_COLOR.

  170. 170. TrFadeX<MILLIS_FUNCTION, N>

  171. 171.     or: TrFade<MILLIS, N>

  172. 172.         // MILLIS_FUNCTION: FUNCTION

  173. 173.         // MILLIS: a number

  174. 174.         // N: a number

  175. 175.         // Transitions back and forth between the two colors several times. (As specified by N).

  176. 176.         // If N is 0, it's equal to TrFade. If N is 1 it transitions A-B-A-B, if N is 2, it is A-B-A-B-A-B, and so on.

  177. 177. TrColorCycle<MILLIS, START_RPM, END_RPM>

  178. 178.         // MILLS:  number

  179. 179.         // START_RPM: a number (defaults to 0)

  180. 180.         // END_RPM: a number (defaults to 6000)

  181. 181.         // return value: COLOR

  182. 182.         // Tron-like transition.

  183. 183. TrConcat<TRANSITION, INTERMEDIATE, TRANSITION, ...>

  184. 184.         // TRANSITION: TRANSITION

  185. 185.         // INTERMEDIATE: COLOR

  186. 186.         // Concatenates (combines) any number of transitions. In between each transition,

  187. 187.         //we need an intermediate color to transition to.

  188. 188. TrDelayX<MILLIS_FUNCTION>

  189. 189.     or: TrDelay<MILLIS>

  190. 190.         // MILLIS_FUNCTION: FUNCTION

  191. 191.         // MILLIS: a number

  192. 192.         // Waits for the specified number of milliseconds, then transitions

  193. 193.         // to second color. Meant to be used with TrConcat

  194. 194. TrFadeX<MILLIS_FUNCTION>

  195. 195.     or: TrFade<MILLIS>

  196. 196.         // MILLIS_FUNCTION: FUNCTION

  197. 197.         // MILLIS: a number

  198. 198.         // Linear fading between two colors in specified number of milliseconds.

  199. 199. TrInstant

  200. 200.         // Instant Transition

  201. 201. TrJoin<TR1, TR2, ...>

  202. 202.         // TR1, TR2: TRANSITION

  203. 203.         // A little hard to explain, but all the specified transitions are run in parallel.

  204. 204.         //Basically, we chain transitions like ((A TR1 B) TR2 B)

  205. 205. TrJoinR<TR1, TR2, ...>

  206. 206.         // Similar to TrJoin, but transitions are chained to the right instead of to the left.

  207. 207.         // Like: (A TR2 (A TR1 B))

  208. 208. TrRandom<TR1, TR2, ...>

  209. 209.         // TR1, TR2: TRANSITION

  210. 210.         // Each time a new transition is started, a random transition is picked from

  211. 211.         // the specified list of transitions.

  212. 212. TrSmoothFadeX<MILLIS_FUNCTION>
  213. 213.
  214. ⁃ // or: TrSmoothFade<MILLIS>
  215. ⁃ // MILLIS_FUNCTION: FUNCTION
  216. ⁃ // MILLIS: a number
  217. ⁃ // return value: TRANSITION
  218. ⁃ // Similar to TrFade, but uses a cubic fading function
  219. 214. // so fading starts slow, speeds up in the middle, then
  220. 215. // slows down at the end.
  221. 216.
  222. 217. TrWipeX<MILLIS_FUNCTION>

  223. 218.     or: TrWipe<MILLIS>

  224. 219.         // MILLIS_FUNCTION: FUNCTION

  225. 220.         // MILLIS: a number

  226. 221.         // Similar to saber ignition. In the beginning entire blade is color A,

  227. 222.         // then color B starts at the base and extends up to the tip of the blade

  228. 223.         // in the specified number of milliseconds.

  229. 224. TrWipeInX<MILLIS_FUNCTION>

  230. 225.     or: TrWipeIn<MILLIS>

  231. 226.         // Like TrWipe, but from tip to base.

  232. 227.    

  233. 233.  

  234. 234.  

  235. 235. —FUNCTIONS—

  236. 236.  

  237. 237. SmoothStep<POS, WIDTH>

  238. 238.         // POS, WIDTH: FUNCTION

  239. 239.         // POS: specifies the middle of the smoothstep, 0 = base of blade, 32768=tip

  240. 240.         // WIDTH: witdth of transition, 0 = no transition, 32768 = length of blade

  241. 241.         // Example: SmoothStep<Int<16384>, Int<16384>> returns 0 up until 25% of the blade.

  242. 242.         // From there it has a smooth transition to 32768, which will be reached at 75% of the blade.

  243. 243.         // If WIDTH is negative, the transition will go the other way.

  244. 244. SmoothSoundLevel

  245. 245.         // Returns 0-32768 based on sound level.

  246. 246.         // returned value: INTEGER

  247. 247. NoisySoundLevel

  248. 248.         // Returns 0-32768 based on sound level.

  249. 249.         // returned value: INTEGER

  250. 250. SwingSpeed<MAX>

  251. 251.         // Returns 0-32768 based on swing speed

  252. 252.         // returned value: INTEGER

  253. 253.  

  254. 254.  

  255. 255.  

  256. 256. ## Additional new Styles in sa22c CC fork release:

  257. 257.  

  258. 258. - Flare<Base_color, Flare_color, Flare Width>

  259. 259. - Stab<Base_color, Stab_Color(White), Stab_millis(500), Stab_width(50)>

  260. 260.  

  261. 261. - LocalizedLockup<Base, Lockup_color, Drag_color, Block_color, Lockup Walk (200ms), Lockup Width (50% of blade), Block Walk (50ms), Block Width (20size), Drag Width (30%)>
Localized Lockup and Force Lightning Lockup (Block) animation effects based on Fett263’s Dual Lockup mod in a single compact style to create a super easy implantation, greatly reducing style sizes – I really want to call attention to the work Matt did on this, this was a very complex and painstaking amount of work to create this excellent update to the effects.

  262. 262.  

  263. 263. - ColorChange<COLORS...> =

  264. 264. List as many colors (or effects) within the style and advance through list using "on-the-fly" change.

  265. 265. Example = ColorChange<Red,Orange,Yellow,Green,DeepSkyBlue,Blue,Pink,Magenta>

  266. 266.  

  267. 267. - ColorChangeFade<TRANSITION (ms), COLORS...> =

  268. 268. List as many colors (or effects) within the style and advance through list using "on-the-fly" change. Each color will fade into the next over the TRANSITION TIME (ms).

  269. 269. Example = ColorChangeFade<400,Red,Orange,Yellow,Green,DeepSkyBlue,Blue,Pink,Magenta> (fade will take 400ms per color)

  270. 270.  

  271. 271. - EffectScroll<DISPLAY (ms), COLORS...> =

  272. 272. List as many colors (or effects) within the style and advance through list using "scroll/select". To change colors/effects activate "Scroll Mode" and continously advance through the list with each item showing for DISPLAY (ms) until you "Select". Shorter display times will act as a quick menu, longer display times will allow the Scroll Mode to act like a DEMO Mode, which can be entered or exited at will.

  273. 273.  

  274. 274. - ColorScroll<DISPLAY (ms), COLORS...> =

  275. 275. List as many colors (or effects) within the style and advance through list using "on-the-fly" change OR "scroll/select". Each "on-the-fly" change will advance through the list one at a time OR activate "Scroll Mode" and continuously advance through the list with each item showing for DISPLAY (ms) until you "Select". Shorter display times will act as a quick menu, longer display times will allow the Scroll Mode to act like a DEMO Mode, which can be entered or exited at will.

  276. 276.  

  277. 277. - ChangeSpark<Base, Spark_color, Transition (ms)>

  278. 278. ChangeSpark allows a Color or Effect to be implemented with “on-the-fly” color change effects.  The Spark color/effect will display and fade over the Transition Time every time the Color Change Effect is activated to add additional “accents” to your color change styles.

  279. 279.  

  280. 280. - EndSpark<Base, Spark_color, Transition (ms)>

  281. 281. EndSpark allows a Color or Effect to be implemented anytime a Lockup is ended, the color/effect will display and fade over the Transition Time to mimic the blade normalizing or cooling off.

  282. 282.  

  283. 283. - OffSpark<Base, Spark_color, Transition (ms)>

  284. 284. OffSpark allows a Color or Effect to be implemented during blade retraction, the color/effect will display and fade over the Transition Time to mimic the blade normalizing or cooling off, when used with an InOutHelper you will want to allow adequate retraction time for the effect to display.

  285. 285.  

  286. 286. -

  287. 287.  

  288. 288. ——————

  289. 289.  

  290. 290. undocumented yet:

  291. 291.  

  292. 292. StyleFire

  293. 293. many more….

  294.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement