New deals posted everyday, starting Black Friday and running through the holiday season! No hassles, no lines - just awesome savings on art, deviantWEAR, Premium Memberships and more!
Artist's Comments
This flash took me for 2.5 hours, and half of them was used to design the layout.
Keep an eye on those numbers on the back. You may found something interesting from it (0, 45, 90, 180, 270). Can someone answer me that why the number 45 also include from the series of those number. I made it because of checking this out - [link] It is a strange flash, it used up for ~130 lines of action script to make it up but I used for ~40 lines only. Maybe there is a much more smilar script for it, if you have any good idea for to perect it, feel free to tell me in the comment box below. =================== The ~130 line of script (My script is on very below): startDrag ("_root.catchMouse", true); // initialize variables var tan = 1.1; // following two lines capture the mouse coordinates function followMe () { mousex = _root.catchMouse._x+10; mousey = _root.catchMouse._y+1; // following two lines capture the movie coordinates ringx = _root.drag_me._x; ringy = _root.drag_me._y; // following two lines capture the distance between the mouse and the movie difx = mousex-ringx; dify = mousey-ringy; // this variable will be used to create acceleration and deceleration incx = difx/80; incy = dify/1200; // making sure the variable is positive if (incx<0) { incx = -(incx); } incy = dify/10; if (incy<0) { incy = -(incy); } // these if statements avoid a "jumping" effect that occurs // when the movie gets to close to the mouse if (difx>-8 && difx<8) { } else if (difx<0) { setProperty ("_root.drag_me", _x, ringx-1-incx); } else { setProperty ("_root.drag_me", _x, ringx+1+incx); } if (dify>-8 && dify<8) { } else if (dify<0) { setProperty ("_root.drag_me", _y, ringy-1-incy); } else { setProperty ("_root.drag_me", _y, ringy+1+incy); } } // this is the code for the rotation of the movie clip towards the mouse function tangens (tan) { if (tan>1) { if (tan>2.41) { if (tan>5.03) { if (tan>10.15) { angle = 90; } else { angle = 84.375; } } else { if (tan>3.3) { angle = 78.75; } else { angle = 73; } } } else { if (tan>1.496) { if (tan>1.87) { angle = 67.5; } else { angle = 61.875; } } else { if (tan>1.22) { angle = 56.25; } else { angle = 50.625; } } } // ****** end of left branch } else { if (tan>0.41) { if (tan>0.67) { if (tan>0.82) { angle = 45; } else { angle = 39.375; } } else { if (tan>0.534) { angle = 33.75; } else { angle = 28.125; } } } else { if (tan>0.198) { if (tan>0.3) { angle = 22.5; } else { angle = 16.875; } } else { if (tan>0.098) { angle = 11.25; } else { angle = 5.625; } } } // ****** end of right branch } angle = angle+baseangle-180; return (angle); } function init (pivotx, pivoty, x, y) { if (x> if (y< // quadrant1 gegenkathete = x-pivotx; ankathete = pivoty-y; baseangle = 0; } else { // quadrant4 gegenkathete = y-pivoty; ankathete = x-pivotx; baseangle = 90; } } else { if (y< // quadrant2 gegenkathete = pivoty-y; ankathete = pivotx-x; baseangle = 270; } else { // quadrant3 gegenkathete = pivotx-x; ankathete = y-pivoty; baseangle = 180; } } tan = gegenkathete/ankathete; return (tan); } // rotate the movie function rotateMe () { pivotx = _root.catchMouse._x; pivoty = _root.catchMouse._y; x = _root.drag_me._x; y = _root.drag_me._y; init(pivotx, pivoty, x, y); tangens(tan); setProperty ("_root.drag_me", _rotation, angle); setProperty ("_root.drag_me", _xscale, 100); setProperty ("_root.drag_me", _yscale, 100); } =================== My script, ~40 lines: _root.onEnterFrame = function() { xbug = getProperty(bug, _x); ybug = getProperty(bug, _y); xmouse = _xmouse; ymouse = _ymouse; rotation = getProperty(bug, _rotation); if (rotation<0) { rotation = 360+rotation; } //--------------------------- if (xbug-_xmouse<0) { setProperty(bug, _rotation, Math.atan((ybug-_ymouse)/(xbug-_xmouse))*180/Math.PI); } else { setProperty(bug, _rotation, 180+Math.atan((ybug-_ymouse)/(xbug-_xmouse))*180/Math.PI); } //--------------------------- if (xbug>_xmouse) { xpathdiff = xbug-_xmouse; } else { xpathdiff = _xmouse-xbug; } if (xbug>_xmouse) { xmove = _xmouse+xpathdiff/1.1; } else { xmove = _xmouse-xpathdiff/1.1; } if (ybug>_ymouse) { ypathdiff = ybug-_ymouse; } else { ypathdiff = _ymouse-ybug; } if (ybug>_ymouse) { ymove = _ymouse+ypathdiff/1.1; } else { ymove = _ymouse-ypathdiff/1.1; } //--------------------------- setProperty(bug, _x, xmove); setProperty(bug, _y, ymove); }; |
Details
April 22
2.7 KB 17.3 KB 549×399 StatisticsShare
Link
Embed
Thumb
|
Comments