How make this movement?

Hi everyone! I’m new in this community and using Processing, so I’m going to explain what is my problem.

I want make a “field road” effect, similar to the one shown in the following link:
https://cs.brynmawr.edu/gxk2013/examples/transformations/starfield/

I know, that is a starfield, but I’m looking to implement a similar effect in a project I’m working on

[image]

I seek to generate an effect in which the squares get closer and give that feeling of being “entering” in those squares.
Sorry if I don’t express myself well, my English is not very good.

I hope they can help me with my problem and that I can continue learning, thanks very much!

1 Like

Welcome, @Lucaso

First, you’ll need to setup an animated sketch.

It’s probably easiest to pull this off if you set the rectMode() to CENTER. Here’s a basic example to riff-off:

void setup() {
  // draw rectangles from the center (not top-left)
  rectMode(CENTER);
}

int size = 0;

void draw() {
  // move the origin to the center of the display window
  translate(width/2, height/2);
  // draw a rectangle
  rect(0, 0, size, size);
  // increment the size value
  size ++;
}

Among other additions, you’ll need to add a loop to draw multiple rectangles, alternating the fills of each.

2 Likes

I made a interactive and similar sketch in the spirit of Vasarely : vasarelo

3 Likes

This is the movement who i’m looking for, thanks so much!!

1 Like