This article has participated in the Denver Nuggets Creators Camp 3 “More Productive writing” track, see details: Digg project | creators Camp 3 ongoing, “write” personal impact.

Chestnut 3 — Dashed line

Another user once asked if he could draw dashed lines with LNP (Lazy Nezumi Pro). Here’s one way to script:

wave = square(d/period, pattern); 
dash = (wave > 0)? p :0; 
op = p ? dash : 0;
Copy the code

Compiling it creates two script parameters :period and pattern. Try a series of value ranges: [10..100] for period and [-0.99..0.99] for pattern.

The first statement of the script uses the predefined Square square wave function to generate a pattern based on the current line spacing D and assign it to the wave variable. You can see a graphical preview of this function here.

The pattern parameter controls the width of the gap, and the period parameter sets the distance in pixels before the pattern repeats. You’ll see that d/period is often used for wave functions, because they have period one.

In the second statement, we check whether the current value of the wave variable is greater than zero. If so, we assign the value of the input pressure variable to the DASH variable. Otherwise, dash will receive zero, which creates a gap.

The third statement assigns the value of DASH to the output pressure variable unless the input pressure is zero, as shown in the previous example.

Here is what happens when Period is set to 30 and Pattern is set to -0.40:

Chestnut 4 — Zipper

Next time

Chestnut 5 — Gear

Next time

Chestnut 6 — Calligraphy

Next time

Chestnut 7 — Shake line

Next time

Chestnut 8 — City scenery

Next time

Chestnut 9 — Lightning

Next time

Chestnut 10 – Signal misidentification

Next time

Chestnut 11 — Debugging

Next time