Hello à tous,
J'ai un petit souci avec un effet de transition.
C'est un code que j'ai récupérer sur le net et adapter a mes besoins.
Il fonctionne a merveille mais uniquement la première fois.
je lui passe un paramètre pour que lorsque j'arrive sur la dernière image, il revienne au début et recommence l'animation.
au premier passage, pas de souci, mais au deuxième mon effet de transition ne se fait plus.
j'ai eu beau chercher des solutions, je ne vois pas pourquoi.
pourriez-vous m'aider?
merci
function wipe(sender) {
//Vars (^^^^) You can easily add them up here
startdepth = 1;
speed = 2;
//^^^ speed of the wipe (1-8)
scalespeed = 1000;
//^^^ speed of the sizing
//mode = 3;
//mode = random(8)+1;
//^^^ wipe direction
steps = 4;
//^^^ circle steps Square 4 Pentagon 5 Circle = about 15
radius = 25;
//^^^ circle radius
removeradius = 3;
//^^^ movieclips removed when this radius is reached
tansdelay = 6;
//^^^ animation/transition delay (frames)
//******************************************
_root.createEmptyMovieClip("wipeContainer", startdepth);
_root.wipeContainer.createEmptyMovieClip("circle", startdepth+1);
//******************************************
//Draw the Circle
//******************************************
lx = Math.cos(0)*12;
ly = Math.sin(0)*12;
sender.setMask(_root.wipeContainer);
_root.wipeContainer.circle.lineStyle(1, 0xFFFFFF, 100);
_root.wipeContainer.circle.moveTo(lx, ly);
_root.wipeContainer.circle.beginFill(0xFFFFFF, 100);
for (s=1; s<steps+2; s++) {
lx = Math.cos((s/steps)*360*Math.PI/180)*radius;
ly = Math.sin((s/steps)*360*Math.PI/180)*radius;
_root.wipeContainer.circle.lineTo(lx, ly);
}
_root.wipeContainer.circle.endFill(0x000000, 100);
_root.wipeContainer.circle._visible = false;
//******************************************
// Grid Creation
//******************************************
i = startdepth+2;
//this is assuming the registration point is centered vert. and horiz.
for (y=sender._y-sender._height/2; y<=(sender._y+sender._height/2)+radius; y += radius) {
for (x=sender._x-sender._width/2; x<=(sender._x+sender._width/2)+radius; x += radius) {
i++;
wipeContainer.circle.duplicateMovieClip("o"+i, i);
created++;
//trace("CREATED" + " " + created);
o = wipeContainer["o"+i];
o._x = x;
o._y = y;
//o._width = radius*2;
//o._height = radius*2;
o._visible = true;
/*if (mode == 1) {
o.wait = x*y/2.5;
}
if (mode == 2) {
//200
o.wait = y*sender._height/2;
}*/
//if (mode == 3) {
o.wait = (-y+sender._height+24)*200;
//}
/*if (mode == 4) {
o.wait = (-x+sender._width+24)*150;
}
if (mode == 5) {
//200
o.wait = x*sender._height/2;
}
if (mode == 6) {
o.wait = (-x+sender._width+24)*y/2;
}
if (mode == 7) {
o.wait = (-y+sender._height+24)*x/2;
}
if (mode == 8) {
o.wait = (-y+sender._height+24)*(-x+sender._width)/2;
}*/
//if
}
//end x for
}
//end y for
enddepth = startdepth+2+i;
//******************************************
// Animation
//******************************************
f = 0;
framed = 0;
_root.onEnterFrame = function() {
if (framed>tansdelay) {
if (done<created) {
for (i=startdepth+2; i<=enddepth; i++) {
obj = _root.wipeContainer["o"+i];
if (obj != undefined) {
//trace(obj.wait);
if (f>obj.wait/(scalespeed*speed)) {
obj._width -= speed;
obj._height -= speed;
}
if (obj._height<=2 || obj._width<=2) {
obj.removeMovieClip();
done++;
}
}
}
} else {
_root.onEnterFrame = null;
}
f++;
}
framed++;
//trace("framed" + " " + framed);
};
}
flag = 0;
stop();
function goToNextframe(){
if (flag == 0)
{
_root.nextFrame();
}
else
{
gotoAndPlay(2);
}
}
setInterval( goToNextframe, 8000 );