Old 07-05-2020, 04:04 AM   #1
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default Overlay Arrow effect

Don't get too excited, this is pretty clunky. All it does is put unicode characters on the screen. So there's no way to control the length of the shaft vs. the size of the head. And there's only 8 angles to choose from.

Code:
// overlay arrow
// TallKite Software 7-5-2020
//@param1:xpos 'x position' 0.5 0 1 0.5 0.01
//@param2:ypos 'y position' 0.5 0 1 0.5 0.01
//@param3:size 'size' 0.1 0.01 0.8 0.1 0.001
//@param4:border 'border' 0 0 1 0.5 0.01
//@param5:angle 'angle' 0 -180 180 0 45

//@param7:h 'arrow hue'        1 0 1 0.5 0.01
//@param8:s 'arrow saturation' 1 0 1 0.5 0.01
//@param9:v 'arrow lightness'  1 0 1 0.5 0.01
//@param10:a 'arrow opacity'    1 0 1 0.5 0.01
//@param11:shadow 'shadow'  0 0 0.1 0.05 0.01

//@param13:h2 'backgd hue'        0.5 0 1 0.5 0.01
//@param14:s2 'backgd saturation' 0.5 0 1 0.5 0.01
//@param15:v2 'backgd lightness'  0.5 0 1 0.5 0.01
//@param16:a2 'backgd opacity'    0.5 0 1 0.5 0.01

font = "Arial";
  angle == -180 ? #text = "↓"    // unicode 2190-2199
: angle == -135 ? #text = "↙"
: angle ==  -90 ? #text = "←"
: angle ==  -45 ? #text = "↖"
: angle ==    0 ? #text = "↑"
: angle ==   45 ? #text = "↗"
: angle ==   90 ? #text = "→"
: angle ==  135 ? #text = "↘"
: angle ==  180 ? #text = "↓";
angle % 10 == 5 ? size *= 0.88;  // keep them about the same size

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 (#text) == 0 ? input_get_name (-1, #text);
gfx_str_measure (#text, 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;
pad = txth / 8;              // extra padding on the sides
gfx_set (r2, g2, b2, a2);
gfx_fillrect (xpos - brd - pad, ypos - brd, 
    txtw + 2*brd + shd + 2*pad, txth + 2*brd + shd);
gfx_set (0, 0, 0, a);
gfx_str_draw (#text, xpos + shd, ypos + shd);
gfx_set (r, g, b, a);
gfx_str_draw (#text, xpos, ypos);
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html
The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com

Last edited by Kite; 07-06-2020 at 01:20 AM. Reason: added name/date to the code
Kite is offline   Reply With Quote
Old 07-05-2020, 08:45 PM   #2
pingosimon
Human being with feelings
 
Join Date: Nov 2018
Posts: 61
Default

Super cool!

You should put your name and date as a comment at the top of your codes. You don't seem the type to care about slapping your name on it, but it's an interesting tidbit for future users! And the date is just helpful for keeping track of versions.
pingosimon is offline   Reply With Quote
Old 07-06-2020, 01:20 AM   #3
Kite
Human being with feelings
 
Join Date: Apr 2010
Location: Portland OR
Posts: 217
Default

Good idea. I added my name and the date.
__________________
alt-tuner: a microtonal midi plug-in: www.TallKite.com/alt-tuner.html
The Kite Guitar, a playable 41-ET guitar: www.KiteGuitar.com
Kite is offline   Reply With Quote
Old 07-07-2020, 12:36 AM   #4
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Simple but very useful idea. And again I see lot of potential if I imagine this could be used to use something like ms webdings or a similar symbol font to cycle thru objects or smileys.

I really like you contributions.

Greetings
Eli
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.