void OpBubble::OnTimeOut(OpTimer* timer) { if (timer == &m_timer) { double duration = GetAnimationDuration(GetAnimation()); double now = g_op_time_info->GetWallClockMS(); double progress = (now - m_timer_start_time) / duration; if (progress < 1) m_timer.Start(BUBBLE_ANIM_TIMER_RES); else progress = 1; if (GetAnimation() == ANIMATION_BOUNCE) { m_extra_distance = (int)((op_fabs(op_cos(progress * M_PI * BUBBLE_ANIM_BOUNCE_COUNT) * (1 - progress * progress))) * BUBBLE_ANIM_BOUNCE_DROP_DISTANCE); Show(); // Fade should be twice as fast as the bounce progress *= 2; progress = MIN(progress, 1); } else if (GetAnimation() == ANIMATION_SHAKE) { m_extra_shift = (int)(op_sin(progress * M_PI * BUBBLE_ANIM_SHAKE_COUNT) * BUBBLE_ANIM_SHAKE_DISTANCE * (1 - progress * progress)); Show(); // Fade should be four times as fast as the shake progress *= 4; progress = MIN(progress, 1); } GetWindow()->SetTransparency((INT32)(progress * 255)); } }
void UMovieSceneAnimationSection::GetSnapTimes(TArray<float>& OutSnapTimes, bool bGetSectionBorders) const { Super::GetSnapTimes(OutSnapTimes, bGetSectionBorders); float CurrentTime = GetAnimationStartTime(); while (CurrentTime <= GetEndTime()) { if (CurrentTime >= GetStartTime()) { OutSnapTimes.Add(CurrentTime); } CurrentTime += GetAnimationDuration(); } }