daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void draw(float progress, bool drawLines)
  2. {
  3.     if (drawLines)
  4.     {
  5.         Line(p1, p2, graphics).draw(Color::black);
  6.         Line(p2, p3, graphics).draw(Color::black);
  7.         Line(p3, p4, graphics).draw(Color::black);
  8.     }
  9.     if (progress > 0)
  10.     {
  11.         draw(progress - 0.002f, false);
  12.     }
  13.  
  14.     Vector2 p12 = p1 + (p2 - p1) * progress;
  15.     Vector2 p23 = p2 + (p3 - p2) * progress;
  16.     Vector2 p34 = p3 + (p4 - p3) * progress;
  17.  
  18.     if (drawLines)
  19.     {
  20.         Line(p12, p23, graphics).draw(Color::green);
  21.         Line(p23, p34, graphics).draw(Color::green);
  22.     }
  23.  
  24.     Vector2 f1 = p12 + (p23 - p12) * progress;
  25.     Vector2 f2 = p23 + (p34 - p23) * progress;
  26.  
  27.     if (drawLines)
  28.     {
  29.         Line(f1, f2, graphics).draw(Color::blue);
  30.     }
  31.  
  32.     Vector2 p = f1 + (f2 - f1) * progress;
  33.  
  34.     Line(p + Vector2(1, 1), p + Vector2(-1, -1), graphics).draw(Color::red);
  35.     Line(p + Vector2(-1, 1), p + Vector2(1, -1), graphics).draw(Color::red);
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top