实战Fireworks MX插件开发指南
on (release) {
// 定义用户输入变量.
var Width = Number(_root.ButW);
var Height = Number(_root.ButH);
var Left = Number(_root.ButL);
var Top = Number(_root.ButT);
var Round = Number(_root.ButR/100);
var BColor = (_root.ButC);
var Right = Left+Width;
var Bottom = Top+Height;
//第二个矩形的参数
var SWidth = Width*0.9;
var SHeight = Height*0.5;
var SLeft = Left+(Width/20);
var STop = Top+(Height/20);
var SRound = Round*1.6;
var SRight = SLeft+SWidth;
var SBottom = STop+SHeight;
//绘制矩形
FWJavascript("fw.getDocumentDOM().addNewRectanglePrimitive({left:"+left+",
top:"+top+", right:"+right+", bottom:"+bottom+"},"+Round+");
");
//填充渐变色
FWJavascript("fw.getDocumentDOM().setFill({ category:'fc_Linear',
ditherColors:[ '#000000', '#000000' ], edgeType:'antialiased', feather:0,
gradient:{ name:'cn_Custom', nodes:[ { color:'#ffffff', isOpacityNode:false,
position:0 }, { color:'"+BColor+"', isOpacityNode:false,
position:1 } ], opacityNodes:[ { color:'#000000', isOpacityNode:true,
position:0 }, { color:'#000000', isOpacityNode:true, position:1
} ] }, name:'Linear Smooth', pattern:null, shape:'linear', stampingMode:'blend
opaque', textureBlend:0, webDitherTransparent:false });");
FWJavascript("fw.getDocumentDOM().setFillVector({x:"+Left+",y:"+Bottom+"},
{x:"+Left+", y:"+Top+"}, {x:"+Right+",
y:"+Bottom+"});");
//添加效果
FWJavascript("fw.getDocumentDOM().applyEffects({ category:'UNUSED',
effects:[ { EffectIsVisible:true, EffectMoaID:\"{5600f702-774c-11d3-baad0000861f4d01}\",
ShadowAngle:315, ShadowBlur:5, ShadowColor:'#000000a6', ShadowDistance:0,
ShadowType:0, category:'Shadow and Glow', name:'Inner Shadow' }
], name:'UNUSED' });");
//绘制第二个矩形
FWJavascript("fw.getDocumentDOM().addNewRectanglePrimitive({left:"+SLeft+",
top:"+STop+", right:"+SRight+", bottom:"+SBottom+"},"+SRound+");
");
//填充第二个矩形
FWJavascript("fw.getDocumentDOM().setFill({ category:'fc_Linear',
ditherColors:[ '#000000', '#000000' ], edgeType:'antialiased', feather:0,
gradient:{ name:'cn_Custom', nodes:[ { color:'#000000', isOpacityNode:false,
position:0 }, { color:'#ffffff', isOpacityNode:false, position:1
} ], opacityNodes:[ { color:'#000000', isOpacityNode:true, position:0
}, { color:'#000000', isOpacityNode:true, position:1 } ] }, name:'Linear
Smooth', pattern:null, shape:'linear', stampingMode:'blend opaque',
textureBlend:0, webDitherTransparent:false });");
//改变第二个矩形的填充方向
FWJavascript("fw.getDocumentDOM().setFillVector({x:"+SLeft+",y:"+SBottom+"},
{x:"+SLeft+", y:"+STop+"}, {x:"+SRight+",
y:"+SBottom+"});");
//改变混合模式
FWJavascript("fw.getDocumentDOM().setBlendMode('screen');");
// End command and release system resources
FWEndCommand(true, "");
}
