This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| prpl:signalgenerator [2016/12/02 23:33] – external edit 127.0.0.1 | prpl:signalgenerator [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| - | === Description === | + | ===== Description ===== |
| - | float ARG1: The time (the X coordinate in the waveform)< | + | Computes the value for a given signal waveform and pushes it to the stack. |
| - | float ARG2: Frequency of the waveform< | + | |
| - | float ARG3: PhaseShift of the waveform< | + | |
| - | bool ARG4: invert the waveform< | + | |
| - | int ARG5: Signal Type (0 to 6)< | + | |
| - | Computes the value for a given signal waveform and pushes it to the stack.<p/> | + | |
| - | SIGNAL TYPES for ARG5< | + | |
| - | 0 = NONE< | + | |
| - | 1 = SINE< | + | |
| - | 2 = SQUARE< | + | |
| - | 3 = TRIANGLE< | + | |
| - | 4 = SAWTOOTH< | + | |
| - | 5 = RANDOM< | + | |
| - | 6 = CONSTANT< | + | |
| - | === Examples === | + | A function to derive the y - coordinate for a given x - coordinate on a graph line following one of the indicated wave patterns. |
| - | < | + | Useful to animate an object or to produce a pattern over time. For instance, could be used to oscillating the brightness of light source or beacon or to |
| - | trace(<-sigValue) | + | vary the strength of an emitter over time. |
| - | </ | + | |
| + | | ||
| + | - Integer.the X coordinate in the waveform(Eg.time) | ||
| + | - Float.Frequency of the waveform | ||
| + | - Float.Phase Shift of the waveform | ||
| + | - Bool.invert the waveform | ||
| + | - Integer.Signal type(0 to 6 in types, below) | ||
| + | |||
| + | | ||
| + | * 0 = NONE | ||
| + | * 1 = SINE | ||
| + | * 2 = SQUARE | ||
| + | * 3 = TRIANGLE | ||
| + | * 4 = SAW - TOOTH | ||
| + | * 5 = RANDOM | ||
| + | * 6 = CONSTANT | ||
| + | {{: | ||
| + | //Visual of 4 periods of each waveform as if they were graphed// | ||
| + | === Notes === | ||
| + | == Phase Shift == | ||
| + | The phase difference, or phase shift as it is also called of a Sinusoidal Waveform, is the | ||
| + | angle Φ(Greek letter Phi), in degrees or radians that the waveform has shifted from a certain reference | ||
| + | point along the horizontal zero axis.In other words phase shift is the lateral difference between two or more | ||
| + | | ||
| + | The phase difference, Φ of an alternating waveform can vary from between 0 to its maximum time period, | ||
| + | T of the waveform during one complete cycle and this can be anywhere along the horizontal axis between, | ||
| + | Φ = 0 to 2π(radians) or Φ = 0 to 360o depending upon the angular units used. | ||
| + | |||
| + | ===== Examples ===== | ||
| + | <code 4rpl> | ||
| + | # starting at coords of the core | ||
| + | # generate a long sine wave of particles once | ||
| + | once | ||
| + | false ->invert | ||
| + | 0 -> | ||
| + | .02 -> | ||
| + | 50 ->length | ||
| + | # frequency * length will be the number of periods of the waveform | ||
| + | # amplitude and widthMulti need to be greater than 4 so particles don't spawn on top of each other | ||
| + | 12 -> | ||
| + | 4 -> | ||
| + | 1 -> | ||
| + | |||
| + | | ||
| + | SignalGenerator(I < | ||
| + | CurrentPixelCoords ->y ->x | ||
| + | <-x I < | ||
| + | <-y < | ||
| + | <-px <-py 0 0 1 1 CreateParticle | ||
| + | loop | ||
| + | endonce | ||
| + | </ | ||