|
SWiSH Forum Forum użytkowników programów SWiSH |
 |
Skrypty do programu SWiSH2 i SWISHmax - Poproszę o naprawę skryptu do kompatybilności z FP10
Januszr - Nie 19 Lut, 2012 11:06 Temat postu: Poproszę o naprawę skryptu do kompatybilności z FP10 Poproszę o "naprawę" poniższego skryptu tak aby działał z FP10.
Kod: | onSelfEvent (load) {
redSpeed1 = 0.1;
greenSpeed1 = 0.07;
blueSpeed1 = 0.04;
redSpeed2 = 0.09;
greenSpeed2 = 0.06;
blueSpeed2 = 0.03;
rotSpeed = 0.01;
i=0;
trigFunc = (Math.randomInt(2)==0) ? Math.cos : Math.sin;
//choose sin or cos function for the angle
gradSTyle = (Math.randomInt(2)==0) ? "radial" : "linear";
//choose gradient style
onenterframe = drawgrad;
}
function drawgrad () {
redAngle1 += redSpeed1;
greenAngle1 += greenSpeed1;
blueAngle1 += blueSpeed1;
redAngle2 += redSpeed2;
greenAngle2 += greenSpeed2;
blueAngle2 += blueSpeed2;
red1 = Math.cos(redAngle1) * 127 + 128;
green1 = Math.cos(greenAngle1) * 127 + 128;
blue1 = Math.cos(blueAngle1) * 127 + 128;
red2 = Math.cos(redAngle2) * 127 + 128;
green2 = Math.cos(greenAngle2) * 127 + 128;
blue2 = Math.cos(blueAngle2) * 127 + 128;
col1 = red1 << 16 | green1 << 8 | blue1;
col2 = red2 << 16 | green2 << 8 | blue2;
rot = trigFunc(rotAngle += rotSpeed) * Math.PI;
colors = [col1,col2];
alphas = [100,100];
ratios = [0,255];
matrix =
{
matrixtype: "box", x:0,y:0,h:600,w:800,r:rot}
this.clear();
this.begingradientfill(gradStyle,colors,alphas,ratios,matrix);
this.lineto(800,0);
this.lineto(800,600);
this.lineto(0,600);
this.lineto(0,0);
this.endfill();
} |
mielu - Nie 19 Lut, 2012 13:35
na pierwszy rzut oka wielkości liter i brak definicji zmiennych
espe1 - Nie 19 Lut, 2012 14:13
Proszę, ale to jakieś starocie i działa tylko z swf6
Kod: |
onSelfEvent (load) {
redAngle1 = 0.01;
greenAngle1 = 0.01;
blueAngle1 = 0.01;
redAngle2 = 0.01;
greenAngle2 = 0.01;
blueAngle2 = 0.01;
rotAngle = 0.01;
greenSpeed1 = 0.07;
blueSpeed1 = 0.04;
redSpeed1 = 0.05;
redSpeed2 = 0.09;
greenSpeed2 = 0.06;
blueSpeed2 = 0.03;
rotSpeed = 0.01;
i=0;
trigFunc = (Math.randomInt(2)==0) ? Math.cos : Math.sin;
//choose sin or cos function for the angle
gradStyle = (Math.randomInt(2)==0) ? "radial" : "linear";
//choose gradient style
this.onEnterFrame = drawgrad;
}
function drawgrad () {
redAngle1 += redSpeed1;
greenAngle1 += greenSpeed1;
blueAngle1 += blueSpeed1;
redAngle2 += redSpeed2;
greenAngle2 += greenSpeed2;
blueAngle2 += blueSpeed2;
red1 = Math.cos(redAngle1) * 127 + 128;
green1 = Math.cos(greenAngle1) * 127 + 128;
blue1 = Math.cos(blueAngle1) * 127 + 128;
red2 = Math.cos(redAngle2) * 127 + 128;
green2 = Math.cos(greenAngle2) * 127 + 128;
blue2 = Math.cos(blueAngle2) * 127 + 128;
col1 = red1 << 16 | green1 << 8 | blue1;
col2 = red2 << 16 | green2 << 8 | blue2;
rot = trigFunc(rotAngle += rotSpeed) * Math.PI;
colors = [col1,col2];
alphas = [100,100];
ratios = [0,255];
matrix =
{
matrixtype: "box", x:0,y:0,h:600,w:800,r:rot}
this.clear();
this.beginGradientFill(gradStyle,colors,alphas,ratios,matrix);
this.lineTo(800,0);
this.lineTo(800,600);
this.lineTo(0,600);
this.lineTo(0,0);
this.endfill();
} |
[ Dodano: Nie 19 Lut, 2012 16:56 ]
Poprawki do swf8+
Kod: | onSelfEvent (load) {
redAngle1 = 0;
redSpeed1 = 0.05;
greenAngle1 = 0;
greenSpeed1 = 0.07;
blueAngle1 = 0;
blueSpeed1 = 0.04;
redAngle2 = 0;
redSpeed2 = 0.09;
greenAngle2 = 0;
greenSpeed2 = 0.06;
blueAngle2 = 0;
blueSpeed2 = 0.03;
rotAngle = 0; //kąt obrotu
wSize = Stage.width; //szerokość
hSize = Stage.height; //wysokość
fillType = "linear"; //lub: "radial"
this.onEnterFrame = drawgrad;
}
function drawgrad () {
rot = Math.cos(rotAngle += 0.001) * Math.PI; //brak obrotów: rot=0, kąt stały np. rot=-90
//col
redAngle1 += redSpeed1;
greenAngle1 += greenSpeed1;
blueAngle1 += blueSpeed1;
r = Math.cos(redAngle1) * 127 + 128;
g = Math.cos(greenAngle1) * 127 + 128;
b = Math.cos(blueAngle1) * 127 + 128;
col = r << 16 | g << 8 | b;
//col2
redAngle2 += redSpeed2;
greenAngle2 += greenSpeed2;
blueAngle2 += blueSpeed2;
r2 = Math.cos(redAngle2) * 127 + 128;
g2 = Math.cos(greenAngle2) * 127 + 128;
b2 = Math.cos(blueAngle2) * 127 + 128;
col2 = r2 << 16 | g2 << 8 | b2;
colors = [col, col2];
alphas = [100, 100];
ratios = [0, 255];
matrix = {matrixType:"box", x:0, y:0, w:wSize, h:hSize, r:rot};
this.clear();
this.beginGradientFill(fillType, colors, alphas, ratios, matrix);
this.lineTo(wSize, 0);
this.lineTo(wSize, hSize);
this.lineTo(0, hSize);
this.lineTo(0, 0);
this.endFill();
}
|
Januszr - Nie 19 Lut, 2012 17:59
Bardzo dziękuję. Jakoś nie miałem wątpliwości, że poradzisz sobie z tym espe1
|
|