Archive: Can u help me out??


5th December 2001 16:48 UTC

Can u help me out??
I am new in this forum.

I subscribed here to get some help. Also I must say that my english is not good at all . Hope that you will understand me OK :)
I have made AVS-s for some time now. I no the basics But I dont still understand anything :(.

So my question is about SuperScope - How to make a small dot that moves from left side to the right and when it is starting to get out of the screen it comes back in the left side and goes again to the right side etc. The movement mut be horizontal and straight.
It is a little hard to explain.

If you did not understand chek out that GIF I made for example.

If possible send the scipt and expain what means what

cheers

Yell


6th December 2001 02:12 UTC

I'm not sure if this is exactly what you're looking for, but try the following, which creates a "wobbling" circle (or ellipse if the containing window is not perfectly square) moving in the manner depicted in your animation. It might lead you in the right direction if nothing else...

In the INIT box :

xpos=-1;
ypos=0;
xspeed=0.01;
scale=0.1;
pi=3.14159;


In the PER FRAME box :

xpos=if(above(xpos,1), -1, xpos + xspeed);
ypos=0;


In the PER POINT box :

xoffset=sin(2 * pi * i) * (v + 1);
yoffset=cos(2 * pi * i) * (v + 1);
x=xpos + (xoffset * scale);
y=ypos + (yoffset * scale);


Here's a rough explanation of the variables :
[list=1][*]"xpos" indicates the x position of the centre (origin) of the circle.[*]"ypos" indicates the y position of the centre (origin) of the circle.[*]"xspeed" indicates the speed and direction at which the origin of circle moves horizontally.[*]"scale" indicates the size of the circle's circumference relative to the AVS window.[*]"pi" is an approximation of the value of Pi (the ratio of a circle's cirucmference to it's diameter) to 6 sig figs.[/list=1]

Here's an explanation of the operations involved, firstly in the INIT box :
[list=1][*]"xpos=-1" indicates that xpos should initially be the far left of the window[*]"ypos=0" means that ypos should initially be the vertical centre of the window[*]"xspeed=0.01" means that the horizontal motion should be positive along the x axis (to the right), at 1% of the available width per frame (or is it 0.5% given that x goes from -1 to 1 ... hmmm)[*]"scale=0.1" means that our circle will be 10% the size of the window (again, maybe 5% given that both x and y range from -1 to 1)[*]"pi=2.14159" just defines the value of Pi, which we will use later in the trigonometric sine and cosine operations.[/list=1]

Next, the PER FRAME box :
[list=1][*]"xpos=if(...)" means that xpos will be set to the value returned by the "if" function, which has the following three arguments...[*]"above(xpos, 1)" is used to test whether the current value of xpos, for the current frame, is greater than 1 (the far right of the window).[*]If the test is True, "-1" is returned, resetting the "xpos" to -1 (the far left of the window).[*]If the test is False, "xpos + xspeed" returns the current value of xpos incremented with the value of xspeed, indicating the position moves horizontally at a direction and speed determined by the "xspeed" value.[*]"ypos=0" shouldn't really be included here, but is to show that if you wish to move the circle vertically, this is the place to fiddle with the ypos value.[/list=1]

Finally, in the PER POINT box :
[list=1][*]"xoffset=sin(2*pi*i)*(v+1)" is used to calculate the value "xoffset", which defines the horizontal offset of the point from the centre of the circle; the horizontal offset of the circumference from the origin. "i" is multiplied by 2pi since the trigonometric functions in AVS operate on RADIANS, not DEGREES (360 degrees = 2pi radians). "v" is included in the equation to "wobble" the circumference depending on the current waveform.[*]"yoffset=cos(2*pi*i)*(v+1)" is used to calculate the respective vertical offset of the circumference from the origin of the circle. The only difference here, is the use of cosine instead of sine.[*]"x=xpos+(xoffset*scale)" tells AVS horizontally where to draw the point, and is calculated from the value of xpos and xoffset (modified by scale so the circle doesn't take up the whole window).[*]Likewise, "y=ypos+(yoffset*scale)" tells AVS the vertical coordinate of the point (likewise scaled).[/list=1]

My apologies if some of this was totally obvious and patronizing, but I'm just trying to cover all the bases :). If you didn't understand any bits, please tell me and I'll try and explain a bit better!

Dave.

6th December 2001 02:23 UTC

Actually I think the easiest way is a Moving Particle and a Dynamic Movement.

First of all, Clear every frame must be checked, either in the Main or the Effect List this is in.

Particle, distance from center set to 0, whatever size you want.

---------------

Dynamic Movement (red are comments):

init: a=0
frame: a=a+.02 (.02 can be moved changed to change speed)
beat: (nothing in this box)
pixel: x=x-a

Check wrap and rectangular coordinates.

:)


6th December 2001 05:21 UTC

Thunk! OW! Thunk! OW! Thunk...

(sound of Dave repeatedly kicking himself :rolleyes: )

flatmatt is absolutely right - forget my diatribe and follow his code - much easier and produces a result much closer to your original animation.

Now, if you'll excuse me, I have some more self-flagulation to attend to.

Thunk... :eek:


6th December 2001 16:18 UTC

Waste of DM
The single-superscope is really the faster solution here. A DM transforms the entire window, while a superscope only draws the needed lines/pixels. The downside is that you won't get total wrapping around the borders, but by letting the circle move beyond the screen you get a nice workaround.

init:
n=100;
rad=0.1;
speed=0.01;
xoff=1+rad;
tpi=acos(-1)*2;

frame:
xoff=if(below(xoff,-1-rad),1+rad,xoff-speed);
rd=rad;

pixel:
rd=rad-rd;
theta=i*tpi;
x=cos(theta)*rd+xoff;
y=sin(theta)*rd;

Tweak n, rad and speed. The preset draws a circle on (xoff, 0) and moves the even pixels in the center of the circle in order to get a filled effect.

Should work ok, but I don't have AVS here to test it out, this is written out of the top of my head.


6th December 2001 22:09 UTC

Yeah, that works, unfortunately, it's not a perfect circle and it goes the wrong way. The latter can be fixed easily, but I guess you'll just have to choose which one works better for you.


6th December 2001 23:33 UTC

if you want to get that look in the gif, do this.
+moving particle
+ dymanic movenent -> alpha=d*5; no movement (just blend) (checked)
nothing else checked.

Then use some of the other dynamic movements that making it shift.

~Horse-Fly


7th December 2001 16:43 UTC

Thank u alll !!!
you are the gratest

new solutions are welcome!
AVS rules !

cheers

Yell


7th December 2001 19:06 UTC

Aspect-ratio fix
Well as for the 'it's not a circle' problem, here's a good fix for all your superscopes:

Frame: af=w/h

Pixel: y=y*af