- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想以数字 8 的 Action 为 UIView
设置动画。我正在使用 BezierPath
在 Swift 中执行此操作,但我想为动画添加延迟。
let center: CGPoint = CGPoint(x: 60, y: 45)
let cent: CGPoint = CGPoint(x: 90, y: 45)
let radius: CGFloat = 15.0
let start: CGFloat = CGFloat(M_PI)
let end: CGFloat = 0.0
let path1: UIBezierPath = UIBezierPath(arcCenter: center, radius: radius, startAngle: start, endAngle: end, clockwise: true)
let path2: UIBezierPath = UIBezierPath(arcCenter: cent, radius: radius, startAngle: -start, endAngle: end, clockwise: false)
let path3: UIBezierPath = UIBezierPath(arcCenter: cent, radius: radius, startAngle: end, endAngle: -start, clockwise: false)
let path4: UIBezierPath = UIBezierPath(arcCenter: center, radius: radius, startAngle: end, endAngle: start, clockwise: true)
let paths: UIBezierPath = UIBezierPath()
paths.appendPath(path1)
paths.appendPath(path2)
paths.appendPath(path3)
paths.appendPath(path4)
let anim: CAKeyframeAnimation = CAKeyframeAnimation(keyPath: "position")
anim.path = paths.CGPath
anim.repeatCount = 2.0
anim.duration = 3.0
view.layer.addAnimation(anim, forKey: "animate position along path")
图 8 工作得很好,但我不知道如何添加延迟。我尝试过使用 animateWithDuration(delay:options:animation:completion:)
之类的方法,但这没有帮助。如果我离题太远,并且有一种更简单的方法可以在“图 8”/“无限循环”运动中为 UIView
设置动画,那会很好。我只需要 Action 加上延迟。
最佳答案
动画对象有开始时间。将其设置为您想要的任何数量的 future 。
anim.beginTime = CACurrentMediaTime() + 1.0
此示例将延迟 1 秒开始。
使用 dispatch_after
block 启动整个动画方法可能会在短期内获得相同的结果,但可能会抑制调整或操作动画相对于开始时的其他计时功能的能力 future 的时间。调整动画本身的时间可以使动画对象的计时状态保持一致。
关于ios - 延迟沿着 BezierPath 动画 UIView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38003614/
我正在尝试根据每个像素的透明度使用BezierPath绘制图像的轮廓。。然而,我对逻辑有一个问题;我的逻辑也画出了内部轮廓。。我只想用BezierPath绘制外部轮廓。我得到的(第一个形状是原始图像,
我将以下代码放在 UIViewController 中: - (void)drawRect:(CGRect)rect { UIBezierPath *trackPath = [UIBezier
我在 Objective-C 中绘制了一个 UIBezierPath 并用红色填充它。现在,我想根据百分比用多种颜色填充路径。例如:我想用 20% 的绿色填充路径,用红色填充剩余的 80%,彼此叠加(
我正在使用 UIbezierpath 为我的项目绘图。我正在使用颜色来绘制。当我在相同的点上绘制时,颜色会变暗。(即通常会在同一个地方绘制)。我想在覆盖时保持画笔颜色。 任何帮助将不胜感激!!!! 最
我想将 UIBezierPath 设置为 View 中的掩码:目标是这样的: 所以我用框架绘制 View : CGFloat round = 80; UIView *myView = [[UIView
嗨,我有一个路径(形状)和一个高分辨率图像。我将高分辨率图像设置为在我绘制路径的 View 内的 AspectFit,我想用路径掩盖图像,但以图像的全分辨率,而不是我们看到路径的分辨率。问题是,当我不
我想要完成什么this demo does但对于iOS。本质上,描边一条路径并在描边时填充它,没有闭合线。 我现在的方法是在 touchesMoved 上,将 CGPath 变量移动到前一个点,并划一
这个问题已经有答案了: How to draw a circle path with color gradient stroke (4 个回答) 已关闭 6 年前。 我读过一些主题,但不适用于我...
我正在尝试沿任意路径为按钮设置动画。为此,我需要创建一个路径,我正在使用 BezierPath。 但是,每当我将 moveToPoint 设置为 0,0 而不是从屏幕左上角开始动画时,就会发生一些奇怪
我想重新创建 AppStore 的“今日”卡片,其中包含圆角和浅色阴影。 我创建了一个路径、一个 maskLayer 和一个单独的 shadowLayer,根据多个消息来源,这是实现它的方式。 然而,
我有一个 tableView 单元格,它有一个 ImageView 。对于这个 View ,我创建了 UIImage 扩展,我在其中使用 bezierPath 2 矩形绘制,然后,我从这个绘图中制作了
我正在使用 swift 2.2,我正在处理这样的问题:我有一组 UIBezier 对象,我需要为它们创建一个笔划作为一条路径。 我曾经有一个特殊的功能,但这种方法的优点是它创建了多个层。这符合我的要求
我有一个包含CGPoints的NSArray,并绘制了从此类返回的路径。问题是[bezierPath closePath]不会关闭此类中的路径。这是为什么?我需要使用此类给我的曲线将端点连接到数组的第
我试图在 UIView 容器内(底部)添加贝塞尔路径(三角形),但是我似乎无法正确理解 UIView 容器的要点。我得到这个结果(其中似乎有一条三角形显示在容器 View 的左侧): 我想要一个输出,
我不知道以下情况: 我从 PaintCode 导出了一个 NSObject 并创建了一个 .swift 文件 (someObject.swift)。 public class PlanATrip: N
我正在尝试检测 UIView 中 BezierPaths 内的 Tap,并发现许多对 containsPoint 方法的引用。但是我似乎无法找到如何从我的 ViewController 中实际引用 B
我正在绘制 BezierPath on Touch 事件。现在我必须使用手势方法在同一位置旋转贝塞尔路径。但问题是,旋转后其位置发生变化。它看起来像下图。我该如何解决这个问题? 上图为原图。与我分享你
我想加载一个包含 uibezierPath 的类的实例,并在应用程序启动时重绘这些先前的路径。字典返回正确的实例,但我无法绘制路径: View 是在 Storyboard中创建的,所以我使用了 ini
我尝试将 uiimageview 的顶部两个角圆化,但以下代码不显示圆角,只显示普通图像。我错过了什么吗?谢谢 UIImageView * imgView = [[UIImageVie
我正在努力实现 https://github.com/joshdhenry/SpinWheelControl我的应用程序中的库,对于每个轮子切片,我试图将自定义图像添加到它的 shapelayer,或
我是一名优秀的程序员,十分优秀!