Itoo Software Forum

Forest Pack => Forest Pro (*) => Topic started by: Gintautas on January 18, 2024, 10:01:14 AM

Title: Animate Scale by Age. Adding startFrame and endFrame
Post by: Gintautas on January 18, 2024, 10:01:14 AM
As it is now, this effect starts at 0 frame, and you can adjust animation length using SecondsToAnimate. But you cant adjust it to start on frame 50, for example.
I tried just randomly grabbing, a snippet of a script from other effect. But at best it doesn't cause any errors, and does nothing in the end. 

Here is a mildly edited effect:
int randCounter = randomInt(startFrame,endFrame);
vector offsetMapAmount = evaluateTexture(OffsetMap,fpItem.distUVW);
real randomStartTime = randomReal(RandomStart, RandomEnd)+(OffsetStart*offsetMapAmount.x);
real TimeInSecs = Max.time/4800.0;
real ActiveTime = if(TimeInSecs>randomStartTime,TimeInSecs-randomStartTime,0.0);

real timePosition = min(1,ActiveTime/SecondsToAnimate);
real newScale = evaluateCurve(XYZ_Scale,timePosition);
fpItem.scale = [newScale,newScale,newScale];
Title: Re: Animate Scale by Age. Adding startFrame and endFrame
Post by: Michal KarmazĂ­n on January 18, 2024, 10:41:07 AM
Hi,

If you want to adjust the time at which the animation starts and ends, you can modify the Animate Scale by Age effect, for example, in the following way:

Code: [Select]
real randomStartTime = randomReal (RandomStart, RandomEnd)+StartTime;
real TimeInSecs = Max.time/4800.0;
real ActiveTime = if(TimeInSecs>randomStartTime,TimeInSecs-randomStartTime,0.0);

real timePosition = min(1,ActiveTime/(EndTime-StartTime));
fpItem.scale.z = evaluateCurve(Z_Scale,timePosition);
real XYScaleValue = evaluateCurve(XY_Scale,timePosition);
fpItem.scale.x = XYScaleValue;
fpItem.scale.y = XYScaleValue;

I hope that helps.

Best regards,