processing how to divide the odd and even of mouse clicks

Updated on technology 2024-05-12
4 answers
  1. Anonymous users2024-02-10

    For such a problem, it is better to create a class for the balls. The spheres contain the position (x,y) and size (d) attributes, as well as the (frozen) feature properties that indicate whether or not they are frozen. There are also functions in the class that make the ball move [update()], display [display()], unfreeze [unfreeze()], refreeze [freeze()], limit range of motion [constrained()], etc.

    Then create multiple balls in the setup() function and freeze the balls initially. Then iterate over each ball in the draw() function and keep update() and display(), which has no effect on the frozen ball, but makes the update() move the unfrozen ball. In the draw() function, it is necessary to constantly determine whether the mouse button is pressed, if the mouse button is pressed and the clicked point is within a certain ball, then the ball will run the unfreeze() function to unfreeze and start moving.

    In addition, in the draw() function, each ball must constantly execute the constrained() function to ensure that the ball does not move beyond the boundary, that is, to achieve the requirement that the subject's ball move to the bottom and then stop.

  2. Anonymous users2024-02-09

    Coordinate conversion. In all the graphics you draw, use the mouse coordinates as the base coordinates.

    Then redraw based on the current position of the mouse. A single RECT can do this, and the principle of combining graphics is the same.

  3. Anonymous users2024-02-08

    [Introduction to Black Holes].

    A particularly dense dark object in the language of general relativity. Massive stars collapse at the end of their evolution, and their matter is so dense that it has a closed boundary called the "event horizon", and the black hole hides a huge gravitational field that is so strong that any matter, including photons, can only enter and cannot escape. The lower limit of the black hole's mass drop is about 3 times the mass of the sun, which, of course, is the mass of the last core, not the mass of the star in the main sequence period.

    In addition to this stellar black hole, there are also other black holes - the so-called miniature black holes may have formed in the early universe, and the so-called supermassive black holes may exist in cosmic galaxies**. (Reference: New Horizons of the Universe).

  4. Anonymous users2024-02-07

    Processing's draw() is an endless loop, the screen will be cleared after each background execution, and to make several balls fall at the same time, you need to recalculate the position of each ball and draw it after each background execution. A simple example is written as follows:

    int y1,y2;

    void setup()

    void draw()

    background(100);

    ellipse(200,y1,20,20);

    ellipse(300,y2,20,20);

    y1+=1;

    y2+=2;

    if (y1>height) {

    y1=0;if (y2>height) {

Related questions
6 answers2024-05-12

The basic actions of the mouse include pointing, clicking, double-clicking, dragging, and right-clicking. >>>More

7 answers2024-05-12

The A970 gaming mouse is equipped with the second-generation KBS key balance system, which can effectively prevent empty key travel problems through a set of mechanical structures. At the same time, it also allows users to get a consistent click trigger feel when triggering the button at all angles, eliminating the trigger dead end. >>>More

23 answers2024-05-12

It's good to choose a wireless mouse, upstart Liberty Leopard 200 MS-146or, and Rapoo 7100, which uses a more advanced photoelectric emitter, that is, a blue light emitter, and the requirements for the desktop will be a little lower when you use it. >>>More

6 answers2024-05-12

Dual-core issues, under the patch here.

43 answers2024-05-12

There may be a compatibility issue.

Clean up Super Bunny with a malware cleaner >>>More