这个JSFL主要是为了做一些破碎特效的时候把一个图形打散到一些小元件。我这里这个JSFL可以把一个矢量图打散到(NXM)小元件,那么得到这些小元件,可以作进一步的处理,尤其是梯度效果。
·什么是破碎梯度效果:点击这里。
JSFL代码如下:
// Initialization the Variables //
// superBreak by awflasher.com v0.1 //
////////////////////////////////////////
//—————————————————–
/* Useage:
1 – Select your vector graphics
2 – change the JSFL parameters – eg, "_run(10,4)"
that stands for the break-apart-method is 10(subSymbols)X4(subSymbols)
2 – Run the JSFL file(From commands menu
3 – wait and get your breaked parts
—>let's go ^__^
*/
// (clear the "//" to run this JSFL . _run (12, 8)
//—————————————————–
//————-Functions——————————-
var _doc = fl.getDocumentDOM ()
var getRect = _doc.getSelectionRect ();
///////////////////////////////////////
// END of Init //
///////////////////////////////////////
//_run ();
////**********Functions**********/////
function pickUpTheSelectedRect (xp, yp)
{
///////////////////////////
// Get the initSelection //
///////////////////////////
_left = getRect.left
_top = getRect.top
_right = getRect.right
_bottom = getRect.bottom;
__width = _right – _left;
__height = _bottom – _top;
__ws = __width / xp;
__hs = __height / yp;
} //End of pickUpTheSelectedRect
function gridSelection (smallRectX0, smallRectY0, smallRectX1, smallRectY1)
{
_doc.setSelectionRect (
{
left : smallRectX0, top : smallRectY0, right : smallRectX1, bottom : smallRectY1
}, true);
} //End of gridSelection
function distributionToGrid (xp, yp)
{
pickUpTheSelectedRect (xp, yp);
for (i = 0; i < xp; i ++)
{
for (j = 0; j < yp; j ++)
{
gridSelection (_left + i * __ws, _top + j * __hs, _left + (i + 1) * __ws, _top + (j + 1) * __hs);
if (_doc.getSelectionRect () != 0)
{
_doc.convertToSymbol ("graphic", "aw4" + i + "_" + j, "top left");
}
}
}
}
function _run (xp, xp)
{
//getTheSelection
distributionToGrid (xp, xp);
}[/quote]
本文来自:http://www.awflasher.com/blog/archives/209
Google更注重原创、时效性好的文章:
| 相关阅读 | 本月十大 |




赞的~~~!
作成组件发布好了~~~呵呵~~
两个问题。
1,没有用户输入界面。
2,只能运行一次。
thx Tomato and Danger ^__^
用户输入界面是一定要有的。可是我的XMLUI就是不听话:(
只能运行一次这个我也发现了,可以在输入界面的时候提示用户输入一个初始化字符串,可是这一切都要建立在我的XMLUI能出来的情况下:(