This document describes the steps necessary to convert projects using the animation components previously available in Scenes version 1.0.11 to the new ScenesAnimations library. Be sure to read through the ScenesAnimations documentation README before proceeding.
- We'll assume that your existing project is called "OldProject".
- We'll assume that your new project name is called "NewProject".
- We'll further assume that these projects share a common parent directory.
git clone https://github.com/TheCoderMerlin/ScenesShell NewProjectcd NewProject/Sources/ScenesShell
rename 's/swift/swift.org/' *.swiftcp -r ../../../OldProject/Sources/ScenesShellD/*.swift .Igis 1.3.5
Scenes 1.1.0
ScenesAnimations 0.1.1Then, in the shell type:
rm .dir-locals.el
dylibEmacsFor all files containing or referencing animation components, import the ScenesAnimations library at the top of the file:
import ScenesAnimationsNow that you have copied your project and imported the ScenesAnimations library, you can simply work through each file ScenesAnimations is working in and correct the highlighted errors. The error messages should contain all the necessary information for converting your project. If further instruction is needed, refer to the following information.
Change references from the AnimationManager type and the animationManager variable to AnimationController and animationController respectively.
// Change from:
let manager = animationManager as AnimationManager
// To:
let controller = animationController as AnimationControlleranimationManager.run(animation: myAnimation, autoPlay: true)
animationManager.getValue(ease: .inOutQuad, percent: 0.5)Instead use:
animationController.register(myAnimation)
myAnimation.play()
EasingStyle.inOutQuad.apply(progress: 0.5)Tween is now a type of Animation, so after creating a Tween, you can treat it directly as an animation:
// Change from:
let myTween = Tween(from:Point(), to:Point(x:100, y:100)) { self.myPoint = $0 }
let myAnimation = Animation(tween: myTween)
animationController.register(myAnimation)
// To:
let myAnimation = Tween(from:Point(), to:Point(x:100, y:100)) { self.myPoint = $0 }
animationController.register(myAnimation)myAnimation.loop = true
myAnimation.reverse = trueInstead use:
myAnimation.repeatStyle = .forever
myAnimation.direction = .alternateAlso, note the inverse property was permanently removed. Instead, you can reuse the same animation by simply changing its direction as needed:
// Change from:
mySecondAnimation = myAnimation.inverse
// To:
myAnimation.direction = .reverseisQueued is no longer available.
let tween = myTween as TweenProtocolTween now conforms to Animation as its non-generic type.
// Change from:
let point = myPoint as Tweenable
// To:
let point = myPoint as Interpolatable// Change from:
let point = myPoint.lerp(to:Point(), percent:0.5)
// To:
let point = myPoint.lerp(to:Point, progress:0.5)// Change from:
EasingStyle.configureInPow(exponent:9)
EasingStyle.configureOutPow(exponent:9)
EasingStyle.configureInOutPow(exponent:9)
// To:
EasingStyle.inPow(exponent:9)
EasingStyle.outPow(exponent:9)
EasingStyle.inOutPow(exponent:9)// Change from:
EasingStyle.inExponential
EasingStyle.outExponential
EasingStyle.inOutExponential
// To:
EasingStyle.inExpo
EasingStyle.outExpo
EasingStyle.inOutExpoNote, the inverse property was permanently removed.
TweenSequence has been temporarily removed. It will be replaced with Timeline in the following updates.