This example shows how you can stretch and set the size of a movie.
Unlike images,
constrainsProportions
istrue
by default.
You can set the width
of an image like so:
mov.width = 100.0
You can set the height
of an image like so:
mov.height = 100.0
You can set the frame
of an image like so:
mov.frame = canvas.frame
let normal = Movie("halo.mp4")!
normal.height = 240
normal.center = canvas.center
let tall = Movie("halo.mp4")!
tall.frame = normal.frame
tall.constrainsProportions = false
tall.height = canvas.height
tall.center = canvas.center
let wide = Movie("halo.mp4")!
wide.frame = normal.frame
wide.constrainsProportions = false
wide.width = canvas.width
wide.center = canvas.center
let full = Movie("halo.mp4")!
full.frame = canvas.frame
let movies = [normal, tall, wide, full]
for mov in movies {
mov.opacity = 0.66
mov.border.color = white
mov.border.width = 0.5
mov.muted = true
mov.loops = true
mov.play()
}
normal.muted = false
canvas.add(full)
canvas.add(tall)
canvas.add(wide)
canvas.add(normal)