Skip to content

Instantly share code, notes, and snippets.

@baiIey
Last active August 29, 2015 14:26
Show Gist options
  • Save baiIey/bf4e364ce92fcf822072 to your computer and use it in GitHub Desktop.
Save baiIey/bf4e364ce92fcf822072 to your computer and use it in GitHub Desktop.
Video layer hides when completed and has event-listeners
bg = new BackgroundLayer
print "background created"
# Create image layer
finishText = new Layer
height: 100, width: 539
image: "youFinish.png"
print "finishText created"
# finishText becomes hidden
finishText.visible = false
print "image is hidden"
#create video layer
videoRabbit = new VideoLayer
width: 640, height: 360,
video: "rabbitShort.mp4"
print "video created"
# Plays video
videoRabbit.player.play()
print "video is playing"
# Waits for click on video
videoRabbit.on Events.Click, ->
videoRabbit.visible = false
finishText.visible = true
print "videoRabbit is hidden and finishText is visible via click"
#listen for video ending
videoRabbit.player.onended = ->
videoRabbit.visible = false
finishText.visible = true
print "videoRabbit is hidden and finishText is visible via video end"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment