【问题标题】:Make a simple fade in animation in Swift for apple watch?在 Swift 中为 Apple Watch 制作简单的淡入淡出动画?
【发布时间】:2015-08-11 13:12:44
【问题描述】:

如何在 swift 中为 Apple Watch 制作简单的动画?

我已经检查了这个blog

但它是关于帧动画,我要求淡入、淡出、旋转与动画

比如使用这个低级函数

 self.view.setAlpha(0.0)

我有安卓背景,所以我正在寻找苹果手表的一些快速功能,比如在安卓等价的

Animation fadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fadein);
imageView.startAnimation(fadeInAnimation );

查看more

or this one

ObjectAnimator fadeIn = ObjectAnimator.ofFloat(myView, "alpha", .3f, 1f);
fadeIn.setDuration(2000)

【问题讨论】:

    标签: swift animation view apple-watch


    【解决方案1】:

    在 Apple Watch 代码中你只需输入

    animateWithDuration(0.3) {
        self.view.setAlpha(0.0)
    }
    

    方法 animateWithDuration 是 WKInterfaceController 的一部分

    【讨论】:

      猜你喜欢
      • 2014-07-29
      • 1970-01-01
      • 1970-01-01
      • 2014-01-20
      • 2012-12-18
      • 2020-12-06
      • 1970-01-01
      • 2019-02-11
      • 1970-01-01
      相关资源
      最近更新 更多