Old 26th November 2007, 00:35   #1
AJ Sindri
Junior Member
 
AJ Sindri's Avatar
 
Join Date: Nov 2007
Posts: 29
Mouse Swirls: Drawing in AVS

This preset is the cornerstone of a few project I've been working on. It basicaly attaches about 30 points to your mouse via a spring like force. The farther away the point is from the mouse, the more force is applied. Each point's "spring" has a different tension.

The Code:
[
//init:

n=2;
det=20;
// How strong the spring is
c=1

//frame:

lpx=px;
lpy=py;
// The position of the point in the last frame

px=px/1.05+cx/2;
py=py/1.05+cy/2;
// Modifies the x and y position of the point based on the momentum of the point and friction (1/1.05)

cx=cx-(px-mx)/det;
cy=cy-(py-my)/det;
// Calculates the acceleration of the point bases on it's position and the mouse's position

c=(px-lpx)/abs(px-lpx)
// Switiches the line around (for a drawing error)

//point:

mx=getkbmouse(1);
my=getkbmouse(2);
ang=atan((py-lpy)/(px-lpx));
dist=sqrt(sqr(lpx-px)+sqr(lpy-py));
x=cos(ang)*i*dist*-c+px;
y=sin(ang)*i*dist*-c+py;

]
For each superscope, "det" is set from 13 to 21 with 1/4 increase from scope to scope.

this got really really old when i would find an error is the code and the would have to modify each superscope seperatly . If you have an easyer way of doing this PLEASE post a comment.

With this you can draw swrils, matrixs, tornadoes etc. It's pretty addictive.

What I'm working on now is the same concept but istead of using spring, i'm trying to use gravity fields (not fun). right now i'm convenced that newtons is a fruad and his gravity = force/(r squared) doesn't work.

The file attached is a remix of mouse swirls. Have fun

Here is my equation as of now for two plantets with the position of your mouse and at .5,-.5 (sorry it's really messy):

init:
n=2;
divis=1.01;
det=15;
c=1

frame:
mx=getkbmouse(1);
my=getkbmouse(2);
lpx=px;
lpy=py;
px=px+cx/2+cxb/2;
py=py+cy/2+cyb/2;
ang1=atan((lpy-my)/(lpx-mx));
ang2=atan((lpy-.5)/(lpx-.5));
cx=cx/divis-(px-mx)/det/(pow(abs(mx-px),2)*15+1)*abs(cos(ang1));
cy=cy/divis-(py-my)/det/(pow(abs(my-py),2)*15+1)*abs(sin(ang1));
cxb=cxb/divis-(px-.5)/det/(pow(abs(.5-px),2)*15+1)*abs(cos(ang2));
cyb=cyb/divis-(py-.5)/det/(pow(abs(.5-py),2)*15+1)*abs(sin(ang2));
c=(px-lpx)/abs(px-lpx);
ang=atan((py-lpy)/(px-lpx));
dist=sqrt(sqr(lpx-px)+sqr(lpy-py));

point:
x=cos(ang)*i*dist*-c+px;
y=sin(ang)*i*dist*-c+py;

It too complicated

If you have any advice, I'd happily accept it!
Attached Files
File Type: zip mouse swirl cold fine.zip (1.0 KB, 322 views)
AJ Sindri is offline   Reply With Quote
Old 27th November 2007, 23:59   #2
Nanakiwurkz
Senior Member
 
Nanakiwurkz's Avatar
 
Join Date: Apr 2006
Location: Planet Shintovia
Posts: 383
hmm this one seems to be in the language of the pros.
sorry man my ssc skills are only limited. but i like the concept.

As far as idiots go i'm not sure.
But as far as genius goes again i'm not sure. Now when it comes to imagination now thats another story.
Nanakiwurkz is offline   Reply With Quote
Old 28th November 2007, 11:58   #3
Grandchild
Senior Member
 
Grandchild's Avatar
 
Join Date: Oct 2005
Location: Germany
Posts: 333
very nice. i really enjoyed playing with it and the galaxy-like shapes you can create when you leave the mouse still for some time.
the thing you're looking for to put it into one scope is called loop() and megabuf(). the first being a sort of "while" loop and the second one is one of the two built-in arrays.
i'd do it but i've got to so some homework first.
maybe i'll look into it again later tody or tomorrow...
amazing work!
gc

/edit: made this i like this preset!
http://img440.imageshack.us/my.php?i...ringavswm4.png

Last edited by Grandchild; 28th November 2007 at 12:18.
Grandchild is offline   Reply With Quote
Old 29th November 2007, 01:14   #4
AJ Sindri
Junior Member
 
AJ Sindri's Avatar
 
Join Date: Nov 2007
Posts: 29
Thx

Thank for your comment. I saw you picture, Pretty sweet . Once you get your acceleration up, move your mouse in a line as the points are swrilling toward it to make a kind of tornado effect.
AJ Sindri is offline   Reply With Quote
Old 30th November 2007, 15:32   #5
ShatteredView
Junior Member
 
ShatteredView's Avatar
 
Join Date: Aug 2007
Posts: 25
This is an awesome concept!
I think it would be cool to add some music response to it, possibly by fading or color change, but it's still awesome.
ShatteredView is offline   Reply With Quote
Old 30th November 2007, 22:00   #6
AJ Sindri
Junior Member
 
AJ Sindri's Avatar
 
Join Date: Nov 2007
Posts: 29
Music Based Mouse Swirl

Thank for your comment. I seems that we think alike because I have already maded a music based swirl attractor, but I didn't post it because I'm still working on it, but I guess that that's what this forum is for.

Sorry it's not the best. I'd love to hear your comments and criticism. I hope you like it:
Attached Files
File Type: zip music swirls green.zip (973 Bytes, 337 views)
AJ Sindri is offline   Reply With Quote
Old 1st December 2007, 20:16   #7
PAK-9
Major Dude
 
PAK-9's Avatar
 
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
AJ there is a simpler way than having to duplicate superscopes, it basically involves caching each line segment into the gmegabuf and reading them out to render in a loop. I recommend you read the programming guide for more help on loops in avs. Unfortunately the language gets very ugly with loops so I recommend getting avstrans... and to be honest, this particular problem wouldnt make for a simple introduction.

There is an alternative time saver.. you can set a register (for example reg01) to 13 in a ssc right at the top of your preset, then in your ssc's that do the actual work, increment the register by 0.25 and use that as your det value. You would still need to delete and recreate each ssc on code chages, but it would just be deleting them and hitting x2 a load of times rather than manually editing each scope.

[edit] nice preset btw [/edit]

http://PAK-9.deviantart.com

...innit
PAK-9 is offline   Reply With Quote
Old 23rd December 2007, 16:29   #8
HuRriC4nE
Member
 
Join Date: Aug 2007
Location: Inside me again
Posts: 56
that could be very cool in 3d...
but the movement would have to be created in random.
hm maybe i'll try something...

right now i'm doing my 3d-flow stuff..

my newest release (aug2007):
http://www.deviantart.com/deviation/61408641/
HuRriC4nE is offline   Reply With Quote
Old 24th December 2007, 01:01   #9
Nanakiwurkz
Senior Member
 
Nanakiwurkz's Avatar
 
Join Date: Apr 2006
Location: Planet Shintovia
Posts: 383
hmm i have a windows bounce detection on this so far in my remix but now that i think about the movement would be very easy to tranlaste to 3d. speaking of which that the lines move in a sort of fashion that reminds me of a delay effect that was used by Nic in his cubic ligation.
No one please use that theme till i try it out. i want to see what it would be like. i'm currently experimenting with counters and delay effects so i might be able to pull something out of my idiotic mind. rfol

As far as idiots go i'm not sure.
But as far as genius goes again i'm not sure. Now when it comes to imagination now thats another story.
Nanakiwurkz is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS > AVS Presets

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump