Archive: Count function


4th May 2004 11:36 UTC

Count function
How about adding a count(#) function where # is a certain number of seconds or frames that it counts up to before reseting to 0 and starting again.
Seems do-able just not sure what you'd use it for.


4th May 2004 12:05 UTC

Frame or beat section, frame for the number of frames per second, or fps, shown at the bottom of the editor, beat for beats:
t=t+0.05;
0.05 is just an example, just stick in a number however much you want it to go up by each beat or frame.

Frame section:
t=if(above(t,1),0,t);
1 can be however much you want it to go up to. 0 Being wherever you want it to go back to when it gets to 1 or whatever you put in.


4th May 2004 12:08 UTC

thanks


6th May 2004 01:19 UTC

You could also use:
t=t+0.05;
t=t*below(t,1.05);


6th May 2004 06:04 UTC

hmf, as long as everyone is giving their opinion, here is mine :p

counter=if(above(counter,resetingpoint),0,counter+value)

That is the basic idea in it, you can use that in the beat or in the frame box.

As for making it seconds... well i have no clean and easy solution but i guess that this *might* work. (use in the frame section)

now=gettime(0) ; fps=1/(now-last) ; last=now ;
second=1/fps ;

Then just use the counter :)

counter=if(above(counter,resetingpoint),0,counter+second)


6th May 2004 08:50 UTC

not quite correct, tug. and REALLY complicated (why use fps when you need seconds? :))


last=now; // save time index of the last frame
now=gettime(0); // get new time index
seconds=now-last; // and calculate the difference
counter=if(above(counter,resettingpoint), // if counter>your defined maximum value then
counter-resettingpoint // subtract that maximum value from the counter
, // otherwise
counter // leave it unchanged
)+seconds // after the if, add the difference from above to it

6th May 2004 09:44 UTC

Just thinking it my way :p

value=value+1/fps , would be value=1 after 1 second i think :)


6th May 2004 09:53 UTC

value=value+seconds is also value=1 after 1 second :)


6th May 2004 10:25 UTC

Yup i realize that now :p


9th May 2004 19:54 UTC

on a slightly related subject, can we either get a new function mod(var,mod) that supports floats or extend the var%mod operator to not cast integers?


10th May 2004 11:45 UTC

i just got another idea that i actually think people could use and instead of posting a new thread i'll just stick it here: a contrast ape or even intergrated into avs that (obviously) increases the contrast of a preset using a slider, very simple and i would find useful.


10th May 2004 11:54 UTC

Why not use an adjustable effectlist with a white clearscreen in it?


10th May 2004 12:53 UTC

For one, it makes it too bright and i know this can be fixed with fast brightness but all that would slow your preset down. For some people that means a lot.

what the crap am i on about...


11th May 2004 07:45 UTC

How about color modifier? Can't you use that? :)


11th May 2004 11:51 UTC

If i knew how to, yes, but i don't so no.
But even if i could you would still have to agree that a contrast ape would save you a lot of time on writing code (due to the fact that there wouldn't be any) and make things much more simple.


12th May 2004 07:02 UTC

Yeah i used to do that a lot too, thinking...
But everytime i said my thoughts out loud i was shot down for my stupid ideas :hang:
And so will be most likely this too.

I don't know this for sure, but i think you can change the contrast and brightness just by multiplying or adding/subtracting from the red, green & blue values.
Example:
red=red*2 ;
green=green*2 ;
blue=blue*2

2x brightness
oh and you might turn off that "calculate every frame" box if your CMo doesn't calculate anything dynamicly.


13th May 2004 01:04 UTC

Yes, multiplying adjust the brightness.
And I think it is possible to do contrast in a colour modifier. I just tried to create one and it kinda worked.


13th May 2004 06:11 UTC

with color modifiers, you can do anything you normally do with a gamma ramp. it's the same thing.
hope that helps you :)
color modifier (as i understand it) creates a so called "gamma ramp", which is basically 3 arrays (one for R, G and B)of bytes with indices ranging from 0 to 255. Let's call these arrays RGamma[0..255], GGamma[0..255] and BGamma[0..255]. In a color modifier you can write to these arrays by modifying 'red', 'green' and 'blue' in the 'level' part of the Color Modifier(they are in the range from 0 to 1 there)
The color modifier then splits every pixel into its red, green and blue components and looks into the red, green and blue Gamma Ramps respectively to get the new value for each channel.


22nd May 2004 12:46 UTC

no that doesn't help me at all.
Just a quick question though, how old are all you people?


24th May 2004 10:13 UTC

Now that's a hardly relevant question... "How old are you?" The heck you are trying to gain with that knowledge?


24th May 2004 23:52 UTC

because i'm only 16, i don't know that much maths and stuff. I just wanted to know how old everyone here is so i can see where i'm at compared to everyone else


25th May 2004 06:44 UTC

Well, intelligence isn't related to age as i've come to witness around here, but there is another thing called wisdom which only comes through experience ;)

Take for example Nic01, i think he just turned 15 and he knows about ten times more math than me and im 21, so knowing about math or something technical does not depend on age.


28th May 2004 01:41 UTC

well 10 points to Nic01