Home>

I want to know how to draw arrows in processing.
Even simple arrows (← and →) cannot be drawn. .

And what kind of code should I write to make the arrows point left and right randomly?

  • Answer # 1

    Processing has the impression that it is an easy-to-learn language that can do it in a little less time than the learning time required to create GUI applications in Java, C #, Python, etc.

    However, minimal learning is still necessary. To create computer software, you need to learn knowledge of grammar and library functions, and use them to understand how to writesomethingI must.

    The impression you received from the question is that you haven't learned "Iroha Noi".

    First, instead of trying to realize the POSTER problem suddenly, while looking at some "Processing tutorial-like samples", "What kind of programming should I do to write something on the screen with Processing?" We recommend that you touch on the basics.

    If you want to learn from information on the Internet, use a search site such as google
    "Processing tutorial"
    For example,

    Processing basics fastest introduction

    Please learn while referring to something like

    . Knowing the basics of this, let's consider "how can there be an arrow?"
    The tutorial should have code samples such as "draw a line" and "draw a string". If you want to draw an arrow with a combination of straight lines, the former sample should be helpful, and if you want to "draw as a character like"→"", the latter sample will be helpful.

    After taking these steps ...

    if (...) {
      text ("→", 100, 100);
    } else {
      text ("←", 100, 100);
    }


    Try to ask a specific question such as "I want to draw either the left or right arrow but I don't know how to write the condition of the if statement when deciding either left or right at random."


    If you don't ask questions when you can write some code, you can only ask "bad questions" called "round throw questions". Keep in mind that it is difficult to answer bad questions. The reason why the round-throw question is not good is that respondents feel that they can present the code of the answer, but do not feel that they have solved the problem of the questioner's programming. Many respondents on this site are not conscious like "a dad who will do homework for children" instead of "I want to help junior programmers improve their ability to solve problems" I think that there are many people who are conscious.

    In order to receive advice from readers with such awareness, it is recommended that the questioning side also ask questions with that level of awareness.

  • Answer # 2

    Reference Information

    Use

    characters

    Draw an arrow with Processing
    http://memorandums.hatenablog.com/entry/2016/05/03/124742

    Rotate arrow text. Whether to display in enlarged or reduced size or to display by drawing a line segment?