View Single Post
Old 14th March 2003, 12:39   #46
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
long essay

This one is all about the 2 in 1 scopes, I wrote all this when I was offline in notepad and then posted it here:
the previous two explainations just explained the concept, now here's the explaination of the actual code:

-----------
Lets just consider the pixel part first because the beat and frame part is just for the movement of the scope.
here's the code for the ssc:

some variables required at initin fact, all the variables in the actual init are required )

n=1000;a1=1/(499-1);vrem=n/10;pi=acos(-1);tpi=acos(-1)*2;
(I will explain their use later on)

reset values per frame :
cn=0;i1=0;

pixel part:
cp=bnot(cp);
cn=cn+1;
i1=i1+a1;
colc=bnot(equal(cn,501));
trans=above(cn,500);
v1=if(bnot(cn%vrem),v,v1+abs(v/10));
d=if(cp,1+v1*0.2,.98);
th=t+i1*tpi;
outx=sin(th)*d;
outy=cos(th)*d;
inx=bnot(cp)*sin(th)*.3;
iny=bnot(cp)*cos(th)*.3;
x=if(trans,outx,inx)+ox;y=if(trans,outy,iny)+oy;
red=colc;green=colc*.5;blue=0;

explaination:
1) value of cp swaps beetween 1 and 0 every point. this is basically used to make solid scopes.
eg:- when we multiply x and y with cp, and when
a) cp=1, then x=x and y=y
b) if cp=0 then x=0 and y=0.
So, after every alternate point, the co-ordinates of the next point are (0,0). so, when we render the scope as lines, the entire part is filled with lines and we get a solid scope (provided the no of pts (n) is quite high)

2) cn:- this is the number of the point drawn. it is reseted to 0 every frame.

3) i1:- Custom i value. i1 is incremented by a1 every point.
value of a1 is 1/(499-1). ie. 488. ie.0.0208333...

4) colc:- used for hiding the point which connects the two objects.
colc=bnot(equal(cn,501));
So, when cn=501, bnot(equal(cn,501)) will return 0 else it will retun 1
cn is the number of the point. bu assigning rgb values to colc, the values for the 501th point will be 0 and for the other points will be 1.

5) trans:- no connection with its name and its values. I too dont remember why I used such a variable name.
trans=above(cn,500); this will return 1 if cn is above 500, else it will return 0. (use explained later).

6) v1: Custom v value.
v1=if(bnot(cn%vrem),v,v1+abs(v/10));
if cn is divided by vrem(n/10 i.e 1000/10 i.e 100)
and the remainder is zero ( vrem is a factor of cn) then return v else return v1+abs(v/10);
In short v1 is used for the waves created in the outer circle. whenever vrem is a factor of cn, then value of v1 will jump to v ( i.e after every 100 point value of v1 will be v), else it will be v1+abs(v/10), the will create the normal waves.

7) d is distance for the outer circle. this will swap beetween .98 and 1+v1*.2 as cp swaps beetween 1 and 0.
d=if(cp,1+v1*0.2,.98);

8) th:- angle ( usually r ) th = t+i1*tpi;
we have used cutom i value, so at the start i1=0 and at the end it is roughly 2. this is because we want to draw basically 2 circles.

9) outx=sin(th)*d;
outy=cos(th)*d;
the outer circle. conversion of polar coords into rectangular coords.

10) inx=bnot(cp)*sin(th)*.3;
iny=bnot(cp)*cos(th)*.3;
the inner circle (d=.3). value swaps beetween 0 and sin(th)*.3 or cos(th)*.3 for the solid fill effect.

11) x=if(trans,outx,inx)+ox;
y=if(trans,outy,iny)+oy;
trans:
trans=above(cn,500);
so, if cn<500 draws the outer circle, else draw the inner circle.

12) red=colc;green=colc*.5;blue=0;
colc:
colc=bnot(equal(cn,501));
if cn=501, then red=0; green=0;blue=0;
if cn!=501 then red=1; green=.5;blue=0.
this is for the orange colour.

finally, i did it. hope you understand this, I havent explained the movment part because it is all normal and basic stuff.

this is the preset I used the scope in:
found in my first pack.

btw. good way to increase posts

http://home.iitb.ac*****~shreyaspotnis

Last edited by shreyas_potnis; 14th March 2003 at 12:58.
shreyas_potnis is offline   Reply With Quote