hey,
i am builiding a photogallery where at each stage i load six thumbnails. Each “placeholder” is initially set to 20% xscale and yscale and when each thumb has fully loaded, i want to have the thumb tween from 20% to 80%. The jpg thumbs are loaded inside the placeholder.
when the thumb has fully loaded, goodToGo = 110 and so i want to trigger the AS tween.
now the problem i have is resetting t variable for each thumb:
//load in the first 6 movies
//set initial scale of holders to 20%
for (var i = 1; i<=6; i++) {
this["thumb"+i+"MainHolder"].thumbHolder.loadMovie("thumbPics/cb"+i+".jpg");
this["thumb"+i+"MainHolder"]._xscale = 20;
this["thumb"+i+"MainHolder"]._yscale = 20;
}
//
//////////////////
t = 0;
w = 0;
duration1 = 70;
duration2 = 80;
initValue = 20;
changeValue = 50;
function scaleUp(mc) {
if(t<duration1){
mc._xscale = Math.easeOutQuint(t, initValue, changeValue, duration1);
mc._yscale = Math.easeOutQuint(t, initValue, changeValue, duration1);
t++;
}
}
this.onEnterFrame = function() {
if (thumb1MainHolder.thumbHolder.goodToGo == 110) {
scaleUp(thumb1MainHolder);
}
if (thumb2MainHolder.thumbHolder.goodToGo == 110) {
scaleUp(thumb2MainHolder);
}
if (thumb3MainHolder.thumbHolder.goodToGo == 110) {
scaleUp(thumb3MainHolder);
}
if (thumb4MainHolder.thumbHolder.goodToGo == 110) {
scaleUp(thumb4MainHolder);
}
if (thumb5MainHolder.thumbHolder.goodToGo == 110) {
scaleUp(thumb5MainHolder);
}
if (thumb6MainHolder.thumbHolder.goodToGo == 110) {
scaleUp(thumb6MainHolder);
}
}
what happens now is that once t>=duration1, the other remaining thumbs don’t tween in scale.
I can see the problem, but cannot figure out how to amend the function scaleUp so that it treats the var t independently for each placeholder.
Any ideas?
please let me know also if there is a better way to achieve this result while keeping the freedom of penner’s functions.
the actual penner function goes like this:
// quintic easing out - decelerating to zero velocity
Math.easeOutQuint = function(t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t+1)+b;
};
to get some idea of how it would look, check out www.viviennewestwood.com and click inside any of the collections.
cheers,