Print  Previous  Next

The shifting function allows you to move the content of the matrix into a given direction. It is declared as follows:

void ShiftPixelMatrix(int x, int y, int w, int h, int dir, int step)
void ShiftVectorMatrix(float x, float y, float w, float h, int dir, float step) 


Again there are two possibilities. One is used with absolute pixel coordinates and values, and one uses relative coordinates and values between 0 and 1.

x, y, w, and h define the pixel area that should be shifted.
step defines how many pixels the content should be shifted into a given direction, which specified by dir.
For dir »the SHIFT_ direction values are allowed. If the value of dir is invalid, the default direction SHIFT_TOP will be used.


The following script for the MAS Script Effect fills the matrix with yellow and draws a red cross onto it during initialization. During the rendering of the content, the whole matrix is shifted downwards. Hence, the cross is moving to the bottom of the matrix. You can simply copy and paste it.

void InitEffect()


    color colbg ={255,255};

    color col ={255};





void RenderEffect()





The script also demonstrates an important behavior of the function. As you can see, the matrix remains yellow, but the cross moves to the bottom. Furthermore, red lines will be drawn on the left and right side. This is due to the fact that the Shift function copies the complete content of the matrix and redraws this picture on the new position. While the the content is moved into the given direction, the original matrix is left unchanged. This leaves the first pixel "line" unchanged in our example.


MADRIX Version: 3.6f | Script Version: 2.19
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
Print   Previous   Next