I dont know how and i have absolutely no idea why but somehow both Smoothdamp calls seem to affect each other.. now somehow both AlbumCover and ExplanationText are both getting Moved in by each others target positions. targetDownPos = new Vector3(ExplanationText.transform.position.x, ExplanationText.transform.position.y - 50, 0); AlbumCoverNormal = new Vector3(AlbumCover.transform.position.x- 1000,AlbumCover.transform.position.y,AlbumCover.transform.position.z);
code:
if (PlayingSlide2AnimationFadeIn)
{
// Increment elapsed time
elapsedTime += Time.deltaTime;
// Calculate the normalized alpha value based on elapsed time
float alpha = Mathf.Clamp01(elapsedTime / 0.5f);
// Set the alpha value of the CanvasGroup
FullScreenImage.color = new Color(1f, 1f, 1f, alpha * 198f / 255f); // Fade in from 0 to 198
ExplanationText.transform.position = Vector3.SmoothDamp(ExplanationText.transform.position, targetDownPos, ref velocity, smoothTime);
if (currentSlide == 3)
{
AlbumCover.transform.position = Vector3.SmoothDamp(AlbumCover.transform.position, AlbumCoverNormal, ref velocity, smoothTime);
}
// Check if the fade effect has finished
if (elapsedTime >= fadeDuration /1.5f)
{
PlayingSlide2AnimationFadeIn = false;
print(ExplanationText.transform.position);
elapsedTime = 0f;
}
}