05-23-2021, 06:33 PM | #1 |
Human being with feelings
Join Date: Apr 2010
Location: Portland OR
Posts: 217
|
multi-line text overlay
Lets you put a paragraph of text on the screen. Also does colored text. I took out the shadow effect because I never use it and there were too many knobs on the GUI. But if you want to put it back in, just uncomment a few lines and add a param line.
Code:
// overlay multi-line text with colors // use leading spaces to center text // use trailing spaces on #text1 to widen the background area #text1= "put your text here"; #text2= " line 2"; #text3= " line 3"; #text4= " line 4 "; numLines = 4; // set to 3 if #text4 is empty font = "Times New Roman"; //"Times New Roman"; // "Arial" //@param1:xpos 'x position' 0 0 1 0.5 0.01 //@param2:ypos 'y position' 0 0 1 0.5 0.01 //@param3:size 'text size' 0.05 0.01 0.2 0.1 0.001 //@param4:sp 'line spacing' 1 1 2 1.5 0.1 //@param5:border 'border' 0.3 0 1 0.5 0.01 //@param7:h 'text hue' 1 0 1 0.5 0.01 //@param8:s 'text saturation' 1 0 1 0.5 0.01 //@param9:v 'text lightness' 1 0 1 0.5 0.01 //@param10:a 'text opacity' 1 0 1 0.5 0.01 //@param12:h2 'back hue' 0.5 0 1 0.5 0.01 //@param13:s2 'back saturation' 0.5 0 1 0.5 0.01 //@param14:v2 'back lightness' 0.5 0 1 0.5 0.01 //@param15:a2 'back opacity' 0.5 0 1 0.5 0.01 //@param17:ignoreinput 'ignore input' 0 0 1 0.5 1 function hue2rgb(p, q, t) ( t < 0 ? t += 1; t > 1 ? t -= 1; t < 1/6 ? ( p + (q - p) * 6 * t; ) : ( t < 1/2 ? ( q; ) : ( t < 2/3 ? ( p + (q - p) * (2/3 - t) * 6; ) : p; ); ); ); s == 0 ? (r = g = b = v) : ( q = v < 0.5 ? v * (1 + s) : v + s - v * s; p = 2 * v - q; r = hue2rgb(p, q, h + 1/3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1/3); ); s2 == 0 ? (r2 = g2 = b2 = v2) : ( q = v2 < 0.5 ? v2 * (1 + s2) : v2 + s2 - v2 * s2; p = 2 * v2 - q; r2 = hue2rgb(p, q, h2 + 1/3); g2 = hue2rgb(p, q, h2); b2 = hue2rgb(p, q, h2 - 1/3); ); input = ignoreinput ? -2:0; project_wh_valid === 0 ? input_info (input, project_w, project_h); gfx_a2 = 0; gfx_blit (input, 1); gfx_setfont (size * project_h, font); strlen (#text1) == 0 ? input_get_name (-1, #text); gfx_str_measure (#text1, txtw, txth); xpos *= project_w - txtw; // convert from percent to pixels ypos *= project_h - txth; brd = border * txth; // border is a % of the text height //shd = shadow * txth; // shadow -- not used in this version pad = txth / 8; // extra padding on the sides sp *= txth; // spacing between the lines gfx_set (r2, g2, b2, a2); // background gfx_fillrect (xpos - brd - pad, ypos - brd, txtw + 2*brd + shd + 2*pad, txth + 2*brd + shd + (numLines - 1)*sp); //gfx_set (0, 0, 0, a); //gfx_str_draw (#text1, xpos + shd, ypos + shd); // shadow gfx_set (r, g, b, a); gfx_str_draw (#text1, xpos, ypos); gfx_str_draw (#text2, xpos, ypos + sp); gfx_str_draw (#text3, xpos, ypos + sp * 2); gfx_str_draw (#text4, xpos, ypos + sp * 3);
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com |
06-08-2021, 01:10 AM | #2 |
Human being with feelings
Join Date: Oct 2009
Location: France
Posts: 743
|
Thank you very much for sharing, it is very useful.
|
06-27-2021, 03:01 AM | #3 |
Human being with feelings
Join Date: Dec 2018
Posts: 11
|
wrap
Hi Kite,
do you know the way to automatically "wrap text" when line i longer than screen? Thank you Cristiano |
06-27-2021, 03:17 AM | #4 |
Human being with feelings
Join Date: Nov 2017
Posts: 1,575
|
@Kite: Thank you! The script complements the
video scripts wonderfully! |
06-28-2021, 06:58 AM | #5 | |
Human being with feelings
Join Date: Apr 2010
Location: Portland OR
Posts: 217
|
Quote:
But I personally am not interested in doing that coding. Perhaps someone else here can do that.
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com |
|
07-02-2021, 06:32 PM | #6 |
Human being with feelings
Join Date: Aug 2020
Location: Brasil
Posts: 679
|
I may have missed something but to my knowledge multi-line text was already possible with this type of syntax:
Code:
// Text overlay #text="1st 2nd 3rd and many more lines"; // set to string to override font="Arial"; |
05-02-2023, 11:37 AM | #7 | |
Human being with feelings
Join Date: Jun 2016
Posts: 267
|
But papagirafe, what about leading? Doing it this way, there's no option to space the lines...
Quote:
|
|
05-02-2023, 06:20 PM | #8 |
Human being with feelings
Join Date: Aug 2020
Location: Brasil
Posts: 679
|
|
Thread Tools | |
Display Modes | |
|
|