Drag direction up and down using variables and conditionals

To be able to drag in different directions, your component must have a draggable object that must extend beyond the component’s bounds.

Just follow this guide:

  1. Create a number variable;
  2. Create a component set containing 2 variants (Minus, Plus);
  3. Apply the variable from step 1 to the text layer of both variants;
  4. Create a rectangle that is 3px higher than your variant’s height;
  5. Put it in each variant;
  6. Set this rectangle to the following coordinates:
    • Minus variant:
      X = 0, Y = -1;

    • Plus variant:
      X = 0, Y = -2;

  7. Add 2 interactions to the rectangles with the “On drag” trigger:
    • Minus variant:
      On drag 1 › Set variable to decrease;
      On drag 2 › Set variable to increase and Change to Plus variant;

    • Plus variant:
      On drag 1 › Set variable to decrease and Change to Minus variant;
      On drag 2 › Set variable to increase.

1 Like