-
Notifications
You must be signed in to change notification settings - Fork 1
looper
뮤네 edited this page Apr 1, 2019
·
26 revisions
- stop()
- pause()
- resume()
- linear()
- backIn()
- backOut()
- backInOut()
- sineIn()
- sineOut()
- sineInOut()
- circleIn()
- circleOut()
- circleInOut()
- quadraticIn()
- quadraticOut()
- bounceOut()
App.looper(block:ItemDSL.()->Unit):Sequence
- 메인 Thread에서 실행 처리
- time(Int) : 시간(밀리세컨, 1000 -> 1초)
- delay(Int) : 딜레이(밀리세컨, 1000 -> 1초)
- loop(Int) : 반복(개), -1이면 무한루프
- block((ChItem)->Unit)) : 실행할 내용
- ended((ChItem)->Unit)) : 종료후 실행할 내용
- isInfinity(Boolean) : 계속 루프하는지 여부
- stop() : Loop를 종료함
- isTurn : time마다 돌아오는 turn인지 체크(아래 예제 참고 할 것)
- Return값 : Sequence(연산자 +나 next 메서드로 여러 개의 looper를 이을 수 있음. looper가 종료 후 다음 looper가 실행됨)
- loop가 -1인 것과 isInfinity의 차이 : 둘 다 무한루프되지만 isInfinity는 isTurn이 없음. 계속 대기해야 되는 경우엔 isInfinity를 쓰고, 몇 초마다 어떤것을 해야할 경우에는 loop(-1)을 이용한다. 둘 다 stop을 호출하면 종료가 된다.
App.looper{
time = 500
block = {
vm.resumeAnimation(it) //it은 ChItem
renderSync()
}
} + {
time = 700
ended = {App.router.unlockPush()}
block = {
vm.title.resumeAnimation(it) //it은 ChItem
renderSync()
}
}
//무한 루프 & 1초마다 실행해야 할때(isTurn) & 무한루프의 종료(stop)
App.looper{
time = 1000
loop = -1
block = {
if(isStop) it.stop()
if(it.isTurn){
///할일..
renderSync()
}
}
}
looper{
time = 350
ended = {base.pop(this@Step1HD)}
block = {
Ch.prop.view.x(view, it.backIn(0.0, w))
}
}
- easing처리를 하는 클래스
stop()
- 실행을 멈춤
stop()
- 실행 일시정지함
stop()
- 실행 일시정지를 취소
linear(from: Double, to: Double): Double
- 실행 easing : linear
override fun resumeAnimation(it: ChItem) {
y = it.linear(Ch.window.height.toDouble(), 0.0)
alpha = it.linear(0.0, 1.0)
}
backIn(from: Double, to: Double): Double
- 실행 easing : backIn
override fun resumeAnimation(it: ChItem) {
y = it.backIn(Ch.window.height.toDouble(), 0.0)
alpha = it.backIn(0.0, 1.0)
}
backOut(from: Double, to: Double): Double
- 실행 easing : backOut
override fun resumeAnimation(it: ChItem) {
y = it.backOut(Ch.window.height.toDouble(), 0.0)
alpha = it.backOut(0.0, 1.0)
}
backInOut(from: Double, to: Double): Double
- 실행 easing : backInOut
override fun resumeAnimation(it: ChItem) {
y = it.backInOut(Ch.window.height.toDouble(), 0.0)
alpha = it.backInOut(0.0, 1.0)
}
sineIn(from: Double, to: Double): Double
- 실행 easing : sineIn
override fun resumeAnimation(it: ChItem) {
y = it.sineIn(Ch.window.height.toDouble(), 0.0)
alpha = it.sineIn(0.0, 1.0)
}
sineOut(from: Double, to: Double): Double
- 실행 easing : sineOut
override fun resumeAnimation(it: ChItem) {
y = it.sineOut(Ch.window.height.toDouble(), 0.0)
alpha = it.sineOut(0.0, 1.0)
}
sineInOut(from: Double, to: Double): Double
- 실행 easing : sineInOut
override fun resumeAnimation(it: ChItem) {
y = it.sineInOut(Ch.window.height.toDouble(), 0.0)
alpha = it.sineInOut(0.0, 1.0)
}
circleIn(from: Double, to: Double): Double
- 실행 easing : circleIn
override fun resumeAnimation(it: ChItem) {
y = it.circleIn(Ch.window.height.toDouble(), 0.0)
alpha = it.circleIn(0.0, 1.0)
}
circleOut(from: Double, to: Double): Double
- 실행 easing : circleOut
override fun resumeAnimation(it: ChItem) {
y = it.circleOut(Ch.window.height.toDouble(), 0.0)
alpha = it.circleOut(0.0, 1.0)
}
circleInOut(from: Double, to: Double): Double
- 실행 easing : circleInOut
override fun resumeAnimation(it: ChItem) {
y = it.circleInOut(Ch.window.height.toDouble(), 0.0)
alpha = it.circleInOut(0.0, 1.0)
}
quadraticIn(from: Double, to: Double): Double
- 실행 easing : quadraticIn
override fun resumeAnimation(it: ChItem) {
y = it.quadraticIn(Ch.window.height.toDouble(), 0.0)
alpha = it.quadraticIn(0.0, 1.0)
}
quadraticOut(from: Double, to: Double): Double
- 실행 easing : quadraticOut
override fun resumeAnimation(it: ChItem) {
y = it.quadraticOut(Ch.window.height.toDouble(), 0.0)
alpha = it.quadraticOut(0.0, 1.0)
}
linear(from: Double, to: Double): Double
- 실행 easing : bounceOut
override fun resumeAnimation(it: ChItem) {
y = it.bounceOut(Ch.window.height.toDouble(), 0.0)
alpha = it.bounceOut(0.0, 1.0)
}