quattro_4 scribble

scribble 落書き (調べた事をただ落書きする)

MotionInMotion Episode 31 - Custom Video Players and Animating Videos

Custom Video Players and Animating Videos - MotionInMotion

ビデオを再生しながらアニメーション

  • PlayerController
    • file_url = NSBundle.mainBundle.URLForResource('big_buck_bunny', withExtension: 'mp4')
    • @player = AVPlayer.playerWithURL(file_url)
    • @player_layer = AVPlayerLayer.playerLayerWithPlayer(@player)
    • @player_layer.speed = 0.2
    • view.layer.addSublayer(@player_layer)
  • controls
    • view.addSubview(@controls = ControlsView.new)
    • @controls.play.addTarget(self, action: 'play:', forControlEvents: UIControlEventTouchUpInside)
    • play, parse, reset, animate
  • reset
    • @player.seekToTime(KCMTimeZero)
    • @player.play
  • animate
    • @scaled ||= false
      • if !@scaled
      • @scaled = !@scaled
    • @player_layer.transform = CATransform3DConcat(
      • CATransform3DMakeScale(0.5, 0.5, 1),
      • CATransform3DMakeTranslation(0, 100, 0)
  • Sample Video