Skip to content

Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.

6.7 KB
Raw Blame
/**
 * The "edgedrop" lettering: one continuous pen line (hand-placed points smoothed
 * into cubic Beziers), in its own units, and where it sits in the 800x640 window.
 * The glass images were shaded once from this same line, so the pen reveal and
 * the glass match exactly.
 */
export const PEN_PATH =
  'M32.0,176.0 C35.5,174.8 51.7,171.7 62.0,166.0 C72.3,160.3 85.7,150.8 94.0,142.0 C102.3,133.2 110.3,120.8 112.0,113.0 C113.7,105.2 108.7,97.8 104.0,95.0 C99.3,92.2 90.5,91.7 84.0,96.0 C77.5,100.3 69.3,111.0 65.0,121.0 C60.7,131.0 57.3,145.5 58.0,156.0 C58.7,166.5 63.2,178.0 69.0,184.0 C74.8,190.0 84.3,192.7 93.0,192.0 C101.7,191.3 113.0,185.7 121.0,180.0 C129.0,174.3 135.3,166.0 141.0,158.0 C146.7,150.0 149.5,139.5 155.0,132.0 C160.5,124.5 166.8,117.2 174.0,113.0 C181.2,108.8 191.0,106.8 198.0,107.0 C205.0,107.2 216.1,114.1 216.0,114.0 C215.9,113.9 203.3,105.0 196.0,104.0 C188.7,103.0 178.7,104.3 172.0,108.0 C165.3,111.7 159.7,117.7 156.0,126.0 C152.3,134.3 149.2,147.8 150.0,158.0 C150.8,168.2 155.3,181.3 161.0,187.0 C166.7,192.7 176.5,194.0 184.0,192.0 C191.5,190.0 200.3,183.7 206.0,175.0 C211.7,166.3 214.3,151.8 218.0,140.0 C221.7,128.2 224.0,116.7 228.0,104.0 C232.0,91.3 238.0,74.0 242.0,64.0 C246.0,54.0 251.7,48.5 252.0,44.0 C252.3,39.5 246.7,35.0 244.0,37.0 C241.3,39.0 238.0,44.2 236.0,56.0 C234.0,67.8 232.3,91.0 232.0,108.0 C231.7,125.0 231.8,144.8 234.0,158.0 C236.2,171.2 239.7,181.5 245.0,187.0 C250.3,192.5 260.0,193.5 266.0,191.0 C272.0,188.5 277.5,180.0 281.0,172.0 C284.5,164.0 283.5,152.0 287.0,143.0 C290.5,134.0 295.8,124.2 302.0,118.0 C308.2,111.8 316.0,106.8 324.0,106.0 C332.0,105.2 349.9,113.1 350.0,113.0 C350.1,112.9 335.7,102.8 328.0,102.0 C320.3,101.2 310.5,103.7 304.0,108.0 C297.5,112.3 292.3,120.0 289.0,128.0 C285.7,136.0 283.2,147.2 284.0,156.0 C284.8,164.8 288.7,176.5 294.0,181.0 C299.3,185.5 309.0,186.0 316.0,183.0 C323.0,180.0 331.0,173.5 336.0,163.0 C341.0,152.5 345.6,119.7 346.0,120.0 C346.4,120.3 350.2,158.0 350.0,175.0 C349.8,192.0 349.0,210.2 345.0,222.0 C341.0,233.8 333.2,242.8 326.0,246.0 C318.8,249.2 305.3,245.5 302.0,241.0 C298.7,236.5 300.3,225.7 306.0,219.0 C311.7,212.3 325.3,206.5 336.0,201.0 C346.7,195.5 359.0,191.5 370.0,186.0 C381.0,180.5 390.3,175.7 402.0,168.0 C413.7,160.3 431.0,149.3 440.0,140.0 C449.0,130.7 454.8,119.5 456.0,112.0 C457.2,104.5 452.0,97.5 447.0,95.0 C442.0,92.5 432.5,92.5 426.0,97.0 C419.5,101.5 412.0,111.8 408.0,122.0 C404.0,132.2 401.0,147.3 402.0,158.0 C403.0,168.7 407.7,180.3 414.0,186.0 C420.3,191.7 431.0,193.3 440.0,192.0 C449.0,190.7 460.0,183.7 468.0,178.0 C476.0,172.3 482.3,165.7 488.0,158.0 C493.7,150.3 496.5,139.5 502.0,132.0 C507.5,124.5 513.8,117.2 521.0,113.0 C528.2,108.8 538.0,106.8 545.0,107.0 C552.0,107.2 563.1,114.1 563.0,114.0 C562.9,113.9 550.3,105.0 543.0,104.0 C535.7,103.0 525.7,104.3 519.0,108.0 C512.3,111.7 506.7,117.7 503.0,126.0 C499.3,134.3 496.2,147.8 497.0,158.0 C497.8,168.2 502.3,181.3 508.0,187.0 C513.7,192.7 523.5,194.0 531.0,192.0 C538.5,190.0 547.3,183.7 553.0,175.0 C558.7,166.3 561.3,151.8 565.0,140.0 C568.7,128.2 571.0,116.7 575.0,104.0 C579.0,91.3 585.0,74.0 589.0,64.0 C593.0,54.0 598.7,48.5 599.0,44.0 C599.3,39.5 593.7,35.0 591.0,37.0 C588.3,39.0 585.0,44.2 583.0,56.0 C581.0,67.8 579.3,91.0 579.0,108.0 C578.7,125.0 578.8,144.8 581.0,158.0 C583.2,171.2 586.7,181.5 592.0,187.0 C597.3,192.5 605.2,193.2 613.0,191.0 C620.8,188.8 632.3,180.2 639.0,174.0 C645.7,167.8 648.8,161.7 653.0,154.0 C657.2,146.3 660.2,135.3 664.0,128.0 C667.8,120.7 675.8,109.4 676.0,110.0 C676.2,110.6 670.7,136.7 670.0,150.0 C669.3,163.3 671.8,190.0 672.0,190.0 C672.2,190.0 674.7,161.3 678.0,150.0 C681.3,138.7 686.0,129.0 692.0,122.0 C698.0,115.0 706.7,109.7 714.0,108.0 C721.3,106.3 729.7,110.3 736.0,112.0 C742.3,113.7 746.0,119.5 752.0,118.0 C758.0,116.5 764.3,105.0 772.0,103.0 C779.7,101.0 791.8,100.5 798.0,106.0 C804.2,111.5 808.8,124.7 809.0,136.0 C809.2,147.3 804.8,164.7 799.0,174.0 C793.2,183.3 781.7,191.0 774.0,192.0 C766.3,193.0 757.0,187.7 753.0,180.0 C749.0,172.3 748.0,157.2 750.0,146.0 C752.0,134.8 758.0,120.2 765.0,113.0 C772.0,105.8 782.5,103.5 792.0,103.0 C801.5,102.5 812.7,110.2 822.0,110.0 C831.3,109.8 840.0,104.7 848.0,102.0 C856.0,99.3 869.5,92.7 870.0,94.0 C870.5,95.3 869.3,125.7 868.0,150.0 C866.7,174.3 862.0,239.3 862.0,240.0 C862.0,240.7 865.7,193.0 869.0,176.0 C872.3,159.0 875.8,149.0 882.0,138.0 C888.2,127.0 897.2,116.3 906.0,110.0 C914.8,103.7 926.8,99.3 935.0,100.0 C943.2,100.7 952.5,105.7 955.0,114.0 C957.5,122.3 955.0,139.5 950.0,150.0 C945.0,160.5 933.5,171.3 925.0,177.0 C916.5,182.7 898.2,184.3 899.0,184.0 C899.8,183.7 917.3,180.0 930.0,175.0 C942.7,170.0 960.7,162.0 975.0,154.0 C989.3,146.0 1011.2,130.2 1016.0,127.0'

/** Places the pen units in the window. */
export const PEN_TRANSFORM = 'translate(54.16 206.28) scale(0.66)'
/** Width of the reveal stroke in pen units (a little wider than the glass tube). */
export const PEN_WIDTH = 27

/** Where each pre-shaded image sits in the window (they were made at 2x). */
export const GLASS_BOX = { x: 65.5, y: 220.5, width: 669, height: 159 }
export const SHADOW_BOX = { x: 56.5, y: 217.5, width: 687, height: 177 }
export const BLUR_BOX = { left: 48.5, top: 204.5, width: 703, height: 197 }

/**
 * How far along the line the pen is (0..1) at 120 even steps of the writing
 * time: slower through tight turns, faster on long sweeps, easing in and out,
 * like a hand. Worked out offline from the same points as PEN_PATH (measuring
 * the path in the page costs ~0.5s of main-thread time).
 */
export const PEN_PACE = [
  0.0000, 0.0050, 0.0103, 0.0159, 0.0217, 0.0269, 0.0323, 0.0382, 0.0450, 0.0536, 0.0620, 0.0698,
  0.0779, 0.0874, 0.0973, 0.1058, 0.1131, 0.1205, 0.1281, 0.1362, 0.1447, 0.1524, 0.1600, 0.1685,
  0.1814, 0.1942, 0.2015, 0.2089, 0.2181, 0.2326, 0.2420, 0.2495, 0.2571, 0.2656, 0.2741, 0.2817,
  0.2891, 0.2964, 0.3044, 0.3127, 0.3204, 0.3279, 0.3359, 0.3435, 0.3509, 0.3607, 0.3723, 0.3803,
  0.3877, 0.3951, 0.4037, 0.4176, 0.4314, 0.4407, 0.4482, 0.4556, 0.4636, 0.4726, 0.4807, 0.4885,
  0.4971, 0.5071, 0.5165, 0.5244, 0.5318, 0.5391, 0.5468, 0.5551, 0.5634, 0.5710, 0.5787, 0.5880,
  0.6023, 0.6128, 0.6202, 0.6275, 0.6390, 0.6525, 0.6608, 0.6685, 0.6768, 0.6868, 0.6941, 0.7015,
  0.7101, 0.7175, 0.7248, 0.7342, 0.7424, 0.7499, 0.7574, 0.7648, 0.7725, 0.7809, 0.7892, 0.7967,
  0.8043, 0.8127, 0.8211, 0.8291, 0.8375, 0.8453, 0.8530, 0.8634, 0.8794, 0.8868, 0.8942, 0.9054,
  0.9167, 0.9260, 0.9338, 0.9414, 0.9490, 0.9567, 0.9626, 0.9680, 0.9730, 0.9792, 0.9869, 0.9938,
  1.0000
]

/** The pen's progress along the line (0..1) at writing time t (0..1). */
export function penProgress(t: number): number {
  const x = Math.min(1, Math.max(0, t)) * (PEN_PACE.length - 1)
  const i = Math.min(PEN_PACE.length - 2, Math.floor(x))
  return PEN_PACE[i] + (PEN_PACE[i + 1] - PEN_PACE[i]) * (x - i)
}