【发布时间】:2019-11-24 17:48:40
【问题描述】:
示例
这是一个包含三个项目的菜单:
这很好。但我想要实现的是:
- 菜单展开
- 然后三个图像淡入AFTER菜单完成扩展
我想也许为不透明度添加第二个延迟动画可能会起作用,但看起来所有动画(运动和不透明度)都被延迟了:
代码如下:
struct SequenceAnimation_SOQuestion: View {
@State private var show = false
var body: some View {
HStack(spacing: 40) {
Group {
Image(systemName: "pencil")
Image(systemName: "scribble")
Image(systemName: "lasso")
}
.opacity(show ? 1 : 0)
.animation(Animation.default.delay(0.5))
Button(action: { self.show.toggle() }) {
Image(systemName: "line.horizontal.3.decrease")
.rotationEffect(.degrees(-90))
}.offset(x: 10)
}
.padding(20)
.padding(.leading, 40)
.foregroundColor(.white)
.background(Capsule().fill(Color.blue))
.font(.largeTitle)
.offset(x: show ? -70 : -320)
.animation(.default)
}
}
【问题讨论】:
标签: swiftui