Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Animator/Interpolator #78

Open
avaidyam opened this issue Jul 18, 2017 · 0 comments
Open

Better Animator/Interpolator #78

avaidyam opened this issue Jul 18, 2017 · 0 comments
Assignees
Milestone

Comments

@avaidyam
Copy link
Owner

A couple things I want to implement/change in the Interpolator and unified Animator view of things:

  • Basic animation modes:

    • KeyPath, from, to
    • KeyPath, from, by
    • KeyPath, to, by
  • Basic animation parameters:

    • duration
    • TimingCurve
    • repeat, etc.
  • Group vs. Sequence

    • Group: executes concurrently.
    • Sequence: executes serially.
  • A better interpolatable protocol would just use [Double]:

public protocol Interpolatable {
    init(with: [Double])
    func components() -> [Double]
}
  • More protocols!
protocol UINode
protocol UIAction
protocol UIAnimation: UIAction
  • Here's an SKAction-centric example of what the API should do:
extension AnimationViewController {
    func animateNodes(_ nodes: [SKNode]) {
        for (index, node) in nodes.enumerated() {
            node.run(.sequence([
                .wait(forDuration: TimeInterval(index) * 0.2),
                .repeatForever(.sequence([
                    // A group of actions get performed simultaneously
                    .group([
                        .sequence([
                            .scale(to: 1.5, duration: 0.3),
                            .scale(to: 1, duration: 0.3)
                        ]),
                        // Rotate by 360 degrees (pi * 2 in radians)
                        .rotate(byAngle: .pi * 2, duration: 0.6)
                    ]),
                    .wait(forDuration: 2)
                ]))
            ]))
        }
    }
}
@avaidyam avaidyam modified the milestone: 1.0 Jul 21, 2017
@avaidyam avaidyam self-assigned this Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant