Skip to content

blendDuration maybe work in this case #2

@nangonghan

Description

@nangonghan
                    .gesture(
                        DragGesture()
                            .onChanged { value in
                                guard !isAnimating else { return }
                                // Update the position while dragging with 弹性跟手
                                withAnimation(.spring(duration: onChangedDuration, bounce: onChangedBounce)) {
                                    self.position = value.location
                                }
                            }
                            .onEnded { _ in
                                guard !isAnimating else { return }
                                // Animate back to center when released with 速度继承
                                withAnimation(.spring(duration: onEndedDuration, bounce: onEndedBounce,blendDuration: 0.25)) {
self.position = CGPoint(
                                            x: geometry.size.width / 2,
                                            y: geometry.size.height / 2
                                        )
                                }
                            }
                    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions