mheavers
mheavers

Reputation: 30168

openframeworks - how to fade a video in and out

Hi I'm using openframeworks ofVideoPlayer() function :

http://www.openframeworks.cc/documentation/video/ofVideoPlayer.html

I've created a video, but I want to fade it out when it is done. Any idea of how to do that?

Upvotes: 1

Views: 2190

Answers (1)

admsyn
admsyn

Reputation: 1461

You can use the getPosition() and getDuration() functions of the ofVideoPlayer to determine when you're near the end of the video. When you want to start fading out the video, start setting the current color to whatever you want to fade to. You'll probably want to use an interpolation function like ofLerp() to create a smooth transition.

If you want to fade out with alpha, make sure you've enabled alpha blending with ofEnableAlphaBlending().

Upvotes: 1

Related Questions