๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Android/Android์˜ ๋ชจ๋“  ๊ฒƒ

๐Ÿ‘‹Android์˜ ๋ชจ๋“  ๊ฒƒ : 1๏ธโƒฃ์•ˆ๋“œ๋กœ์ด๋“œ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ๋ชจ๋“  ๊ฒƒ

728x90

https://goni95.tistory.com/173

 

๐Ÿ‘‹Android์— ๋ชจ๋“  ๊ฒƒ ๊ฐœ๋…

๋ชฉ  ์ฐจ ์˜ˆ์ œ Android ๐Ÿ‘‹Android์— ๋ชจ๋“  ๊ฒƒ : 1๏ธโƒฃAndroid, 2๏ธโƒฃAndroid SDK, 3๏ธโƒฃPlatform Architecture ๐Ÿ‘‹Android์— ๋ชจ๋“  ๊ฒƒ ๊ฐœ๋… : 1๏ธโƒฃApp Manifest, 2๏ธโƒฃAndroid Context, 3๏ธโƒฃApp Components ๐Ÿ‘‹Androi..

goni95.tistory.com

 

์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•๊ณผ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ข…๋ฅ˜๋Š” ๋‹ค์–‘ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์œ ํ˜•๋ถ€ํ„ฐ ๋ฌด์—‡์„ ์„ ํƒํ• ์ง€ ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•๊นŒ์ง€ ์ •๋ฆฌํ•ด๋ณผ๊นŒ ํ•ฉ๋‹ˆ๋‹ค.

 

๊ฐœ๋…์„ ์šฐ์„  ์ •๋ฆฌํ•ด๋‘๊ณ  ๊ฐ๊ฐ์˜ API๋ฅผ ์‚ฌ์šฉํ•  ์ผ์ด ์žˆ์„ ๋•Œ ์˜ˆ์ œ๋ฅผ ์ •๋ฆฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

์šฐ์„  ์• ๋‹ˆ๋ฉ”์ด์…˜ API์˜ ์ข…๋ฅ˜๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์ •๋ง ๋‹ค์–‘ํ•ฉ๋‹ˆ๋‹ค.

  1. ViewAnimations (API 1)
  2. ValueAnimator, ObjectAnimator (API 11)
  3. ViewPropertyAnimator (API 12)
  4. Transitions (API 19)
  5. AnimatedVectorDrawable (API 21์— ์ถ”๊ฐ€๋˜์—ˆ์ง€๋งŒ AndroidX๋กœ ํ•˜์œ„ ๋ฒ„์ „๋„ ์‚ฌ์šฉ ๊ฐ€๋Šฅ)
  6. Physics, MotionLayout (AndroidX)

 

1. ViewAnimations

์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐ€์žฅ ์ดˆ๊ธฐ์— ์“ฐ์ด๋˜ API

1-1. Tween Animation

View์— ์ ์šฉ๋˜๋Š” ์• ๋ฏธ๋„ค์ด์…˜์œผ๋กœ View์˜ ํฌ๊ธฐ / ์œ„์น˜ / ํšŒ์ „ / ํˆฌ๋ช…๋„(ํŽ˜์ด๋“œ) ์กฐ์ •์„ ๋‹ด๋‹นํ•˜๋ฉฐ res/anim/ ๋””๋ ‰ํ† ๋ฆฌ์— <scale>, <translate>, <rotate>, <alpha> ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ xml ํŒŒ์ผ์„ ์ •์˜ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

1-2. Frame Animation

๋น„๋””์˜ค ํ”„๋ ˆ์ž„์ฒ˜๋Ÿผ ์‹คํ–‰๋˜๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์œผ๋กœ XML์— ์ •์˜๋œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ˆœ์ฐจ์ ์œผ๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค. drawable์„ ์‚ฌ์šฉํ•˜์—ฌ ์ ์šฉ๋˜๊ณ  res/drawable/ ๋””๋ ‰ํ† ๋ฆฌ์— <animation-list>, <item> ํƒœ๊ทธ ๋“ฑ์„ ์‚ฌ์šฉํ•ด ์ˆœ์ฐจ์ ์œผ๋กœ ํ‘œ์‹œํ•  drawable ๋ชฉ๋ก์„ ์ง€์ •

 

์ฃผ์˜ํ•  ์ ์€ ViewAnimations View์˜ ์†์„ฑ์ด ๋ฐ”๋€Œ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์—, View๋ฅผ ๋‹ค๋ฅธ ์œ„์น˜๋กœ ์ด๋™์‹œํ‚ค๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ–ˆ๋”๋ผ๋„ View์˜ ์†์„ฑ์€ ์ฒ˜์Œ ์œ„์น˜์— ๊ทธ๋Œ€๋กœ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํด๋ฆญ ์ด๋ฒคํŠธ ๋“ฑ์˜ ์ด๋ฒคํŠธ์— ๋ฐ˜์‘ํ•˜์ง€ ๋ชปํ•ฉ๋‹ˆ๋‹ค.

 

์œ„์—์„œ ๋งํ•œ ์ฃผ์˜ํ•  ์ ๊ณผ View Animations๋กœ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์€ ViewProperyAnimator๋ฅผ ์‚ฌ์šฉํ•ด๋„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๊ณ  ๋” ๋น ๋ฅด๊ณ  ๊ฐ„๊ฒฐํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ž˜ ์“ฐ์ด์ง€ ์•Š๋Š”๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

 

2. Property Animation(ValueAnimator, ObjectAnimator)

๊ฐ์ฒด์˜ ์†์„ฑ์„ ๋ณ€๊ฒฝํ•˜์—ฌ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ง€์ •ํ•˜๊ธฐ ๋•Œ๋ฌธ์— Property Animation์œผ๋กœ ๋ถˆ๋ฆฝ๋‹ˆ๋‹ค. 

์ง€์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. Duration : ์žฌ์ƒ ์‹œ๊ฐ„ ์ง€์ •
  2. Time interpolation : ์‹œ๊ฐ„์— ๋”ฐ๋ฅธ ์†์„ฑ ๊ฐ’์˜ ๋ณ€ํ™” ์ •๋„๋ฅผ ์ง€์ •
  3. Repeat count and behavior : ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ฐ˜๋ณต์„ ์ง€์ • / ์—ญ๋ฐฉํ–ฅ ์žฌ์ƒ ๊ฐ€๋Šฅ
  4. Animator sets : ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๋™์‹œ์— ํ˜น์€ ์ˆœ์ฐจ์ ์œผ๋กœ ์žฌ์ƒ
  5. Frame refresh delay : ์• ๋‹ˆ๋ฉ”์ด์…˜ ํ”„๋ ˆ์ž„์˜ ์ƒˆ๋กœ ๊ณ ์นจ ๋นˆ๋„๋ฅผ ์ง€์ •

 

2-1. ValueAnimator

ValueAnimator๋Š” ๋‹ค๋ฅธ ์• ๋‹ˆ๋ฉ”์ด์…˜ API์˜ ๊ธฐ๋ฐ˜์ด ๋  ์ •๋„๋กœ ํ›จ์”ฌ ๊ฐ•๋ ฅํ•ด์ง„ API๋กœ, View ๋˜๋Š” View๊ฐ€ ์•„๋‹Œ ๊ฐ์ฒด ๋“ฑ ๋ชจ๋“  ๊ฒƒ๋“ค์— Animation ํšจ๊ณผ๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ค‘์š”ํ•œ ์ ์€ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๊ฐ’์„ ์ ์šฉํ•  ์œ„์น˜๋ฅผ ์ง€์ •ํ•˜๋Š” onAnimationUpdate() ๋ฉ”์„œ๋“œ๋ฅผ ์žฌ์ •์˜ํ•˜๊ธฐ ์œ„ํ•œ ValueAnimator.AnimatorUpdateListener๋ฅผ ๊ตฌํ˜„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

ValueAnimator ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์• ๋‹ˆ๋ฉ”์ด์…˜ํ™”ํ•  int, float, ์ƒ‰์ƒ ๊ฐ’ ์ง‘ํ•ฉ์„ ์ง€์ •ํ•˜์—ฌ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ง„ํ–‰๋˜๋Š” ๋™์•ˆ ํŠน์ • ์œ ํ˜•์˜ ๊ฐ’์„ ์• ๋‹ˆ๋ฉ”์ด์…˜ํ™”ํ•  ์ˆ˜ ์žˆ๊ณ , Factory method์ธ onInt(), ofFloat(), ofObject() ์ค‘ ํ•˜๋‚˜๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

2-2. ObjectAnimator

ValueAnimator์˜ ํ•˜์œ„ ํด๋ž˜์Šค๋กœ ValueAnimator์˜ ํƒ€์ด๋ฐ ์—”์ง„ ๋ฐ ๊ฐ’ ๊ณ„์‚ฐ๊ณผ ๋Œ€์ƒ ๊ฐ์ฒด์— ๋ช…๋ช…๋œ property์— ์• ๋‹ˆ๋ฉ”์ด์…˜ํ™”ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๊ฒฐํ•ฉํ•ฉ๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ property๊ฐ€ ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ ๋˜๊ธฐ ๋•Œ๋ฌธ์— ValueAnimator.AnimatorUpdateListener๋ฅผ ๊ตฌํ˜„ํ•  ํ•„์š”๊ฐ€ ์—†์–ด์ง€๋ฏ€๋กœ ๊ฐ์ฒด์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ํ™”๊ฐ€ ํ›จ์”ฌ ์‰ฌ์›Œ์ง‘๋‹ˆ๋‹ค.

 

ValueAnimator๋Š” ์ฝ”๋“œ์—์„œ ValueAnimator.ofFloat(0f).addUpdateListener { ... }.start() ์‹์œผ๋กœ ์‚ฌ์šฉ๋˜๋ฉฐ, ObjectAnimaotr๋Š” ObjectAnimator.ofFloat(view, View.ALPHA, 0f).start() ๋ฐฉ์‹๊ณผ  res/animator/ ๋””๋ ‰ํ† ๋ฆฌ์— <objectAnimator> ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

3. ViewPropertyAnimator

ValueAnimator๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๋™์ž‘ํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์ง์ ‘ Animator object๋กœ ์ธ์Šคํ„ด์Šคํ™” ํ•  ํ•„์š”๊ฐ€ ์—†์œผ๋ฏ€๋กœ, ์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์ œ๊ณตํ•˜๋Š” ๊ฐ„๋‹จํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š” API ์ž…๋‹ˆ๋‹ค. ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์ˆœ์ฐจ ์ฒ˜๋ฆฌ์™€ ์ปค์Šคํ„ฐ๋งˆ์ด์ง•ํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋“ฑ์˜ ๋ณต์žกํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜์€ ์ ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

 

animate() ๋ฉ”์„œ๋“œ๋ฅผ ํ†ตํ•ด์„œ ๊ตฌํ˜„ํ•˜์ง€๋งŒ, ์ž์ฒด์ ์œผ๋กœ ๋ฐ˜๋ณต ๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ  ์žˆ์ง„ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์™ธ๋ถ€์—์„œ ๋”ฐ๋กœ ๋ฐ˜๋ณต์‹œํ‚ค๋„๋ก ์ฒ˜๋ฆฌํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ง„ํ–‰ ์ค‘์— ๋‹ค์‹œ start()๋ฅผ ํ•˜๋ฉด, ์ด์ „ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ๋ฉˆ์ถ˜ ์ง€์ ๋ถ€ํ„ฐ ๋‹ค์‹œ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

๋ฐ–์—์„œ ๋”ฐ๋กœ ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์ง„ํ–‰ ์ƒํ™ฉ์„ ๊ด€๋ฆฌํ•  ์ˆœ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์‹คํ–‰์‹œํ‚ค๊ณ  ์‹ ๊ฒฝ ์“ธ ํ•„์š” ์—†๋Š” *fire-and-forget ํ˜•์‹์œผ๋กœ ์“ฐ์ž…๋‹ˆ๋‹ค.

 

4. Transitions

*Shared Element Transition์„ ๊ตฌํ˜„ํ•  ๋•Œ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ๋˜๋ฉฐ, ์•กํ‹ฐ๋น„ํ‹ฐ ๊ฐ„ ์ „ํ™˜ ์‹œ ๊ณต์œ  ์š”์†Œ์— ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋™์ผํ•œ ์•กํ‹ฐ๋น„ํ‹ฐ ๋‚ด์—์„œ View ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์• ๋‹ˆ๋ฉ”์ด์…˜์œผ๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Transition์€ ์•กํ‹ฐ๋น„ํ‹ฐ A์—์„œ ์ปจํ…์ธ  ๋ ˆ์ด์•„์›ƒ์œผ๋กœ ์ „ํ™˜ํ•  ๋•Œ ์•กํ‹ฐ๋น„ํ‹ฐ B์— ์ •์˜๋œ Transition์— ๋”ฐ๋ผ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ฉ๋‹ˆ๋‹ค.

 

android.transition.Transition์—๋Š” ๋ฏธ๋ฆฌ ์ •์˜๋œ ์„ธ ๊ฐ€์ง€(Explode, Slide, Fade)์˜ Transition์ด ์žˆ์Šต๋‹ˆ๋‹ค.

 

5. AnimatedVectorDrawable

ObjectAnimator ๋˜๋Š” AnimatorSet์„ ์‚ฌ์šฉํ•˜์—ฌ ์ •์˜๋œ ์• ๋‹ˆ๋ฉ”์ด์…˜์œผ๋กœ VectorDrawable์˜ ์†์„ฑ์— ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.

AndroidX ์‚ฌ์šฉ ์‹œ AnimatedVectorDrawableCompat์œผ๋กœ ์‚ฌ์šฉ๋˜๊ณ  ๊ธฐ์กด์— UI Thread์—์„œ ์‹คํ–‰๋˜๋˜ ๊ฒƒ๊ณผ ๋‹ฌ๋ฆฌ ์•ˆ๋“œ๋กœ์ด๋“œ 7.1 (Nougat-MR1 : API 25)๋ถ€ํ„ด RenderThread์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

 

ํŠน์ • ์ง€์ ์œผ๋กœ seekํ•˜๋Š” ๋“ฑ์˜ ๊ธฐ๋Šฅ์€ ์ง€์›ํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— *fire-and-forget ํ˜•์‹์œผ๋กœ ์‚ฌ์šฉ๋˜๊ณ  ์„ฌ์„ธํ•œ ์ปจํŠธ๋กค์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ Lottie๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

 

6. MotionLayout

ConstraintLayout 2.0.0 ๋ถ€ํ„ฐ ์ถ”๊ฐ€๋œ API๋กœ ConstraintLayout์ด๋ฉด์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜์— ์ค‘์ ์„ ๋‘” ์ƒˆ๋กœ์šด ViewGroup ์ž…๋‹ˆ๋‹ค.

 

MotionScenes๋ผ๋Š” xml ํŒŒ์ผ์— <Transition> <OnSwipe> <ConstraintSet> ๋“ฑ์˜ ํƒœ๊ทธ๋ฅผ ์ •์˜ํ•ด ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ๋ฅผ ๋งŒ๋“ค์–ด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


 

๊ณ ์ฐฐ

์ด๋ ‡๊ฒŒ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜€ํ•  ๋•Œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” API ๋“ค์„ ํ™•์ธํ•ด๋ดค๋Š”๋ฐ, ๊ตฌํ˜„๋œ ์• ๋‹ˆ๋ฉ”์ด์…˜์— ๋Œ€ํ•œ ์ž๋ฃŒ๋ฅผ ์ฐพ์•„๋ณด๋ฉด ์ •๋ง ์ด์˜๊ณ  ํ™”๋ คํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ฐพ์•„๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์šฐ๋ฆฌ๊ฐ€ ์‹ค์ œ๋กœ ์‚ฌ์šฉํ•˜๋Š” ์•ฑ์—์„  ๊ทธ๋Ÿฐ ๊ธฐ๋Šฅ๋“ค์„ ํ™œ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋ฅผ ๋งŽ์ด ์ฐพ์•„๋ณด๊ธฐ ์–ด๋ ต๋‹ค๊ณ  ์ƒ๊ฐ๋ฉ๋‹ˆ๋‹ค.

 

์‚ฌ์‹ค ์‹ค์ œ๋กœ ๋นŒ๋“œ๋œ ๊ฒฐ๊ณผ๋ฌผ์„ ํ™•์ธํ•˜๋ฉฐ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๊ธฐ๋•Œ๋ฌธ์— UI๋ฅผ ๊ตฌํ˜„ํ•  ๋•Œ ๋งŽ์€ ์‹œ๊ฐ„์ด ์†Œ์š”๋˜๊ธฐ๋„ ํ•˜๊ณ  MVP, MVVM ๊ฐ™์€ ์•„ํ‚คํ…์ฒ˜ ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ  ์ค‘ ํ•˜๋‚˜๊ฐ€ View๊ฐ€ ํ•˜๋Š” ์ผ์„ ์ค„์ด๋ ค๋Š” ๊ฒƒ์ธ๋ฐ, ์• ๋‹ˆ๋ฉ”์ด์…˜์€ ์˜คํžˆ๋ ค View Layer์— ์ž‘์—…์„ ๋ถ€์—ฌํ•˜์—ฌ ๋ณต์žก๋„๊ฐ€ ์˜ฌ๋ผ๊ฐ€๊ณ  ์œ ์ง€๋ณด์ˆ˜ ๋น„์šฉ๋„ ๋งŒ๋งŒ์น˜ ์•Š์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  UI๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” Animator๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์‹คํ–‰๋˜๋Š” ๊ฒฝ์šฐ ์ถ”๊ฐ€ ๋ Œ๋”๋ง ์ž‘์—…์„ ์œ ๋ฐœํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์•ฑ ์„ฑ๋Šฅ์— ์•…์˜ํ–ฅ์„ ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

ํ™”๋ คํ•˜๊ณ  ๋ณต์žกํ•œ Animation ๊ตฌํ˜„์ด ์‚ฌ์šฉ์ž์—๊ฒŒ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•˜๋ ค๋Š” ๊ถ๊ทน์ ์ธ ๋ชฉ์ ์— ๋น„ํ•ด ๊ฐ€์„ฑ๋น„๊ฐ€ ๋–จ์–ด์ง€๋‹ˆ ์ตœ์†Œํ™” ํ•˜๋ ค๋Š” ๊ฒƒ์ด ์•„๋‹๊นŒ ์‹ถ์Šต๋‹ˆ๋‹ค.

 

UI ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•  ๋•Œ Profile GPU Rendering ๋„๊ตฌ๋ฅผ ์ด์šฉํ•ด ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋‹จ๊ณ„๋ฅผ ๋ชจ๋‹ˆํ„ฐ๋ง ํ•˜๋ฉฐ ์•ฑ ์„ฑ๋Šฅ์— ์–ด๋Š์ •๋„ ์˜ํ–ฅ์„ ์ฃผ๋Š”์ง€ ํ™•์ธํ•˜๋ฉฐ ์ž‘์—…ํ•˜๋Š” ๊ฒƒ์ด ์ข‹๊ณ  ๊ตฌํ˜„ํ•˜๋ ค๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์— ๋”ฐ๋ผ ์ ์ ˆํ•œ ๋ฐฉ๋ฒ•์„ ์ฐพ๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.


 

๊ฐ€์ด๋“œ

๊ทธ๋Ÿผ ๊ตฌํ˜„ํ•˜๋ ค๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์— ๋Œ€ํ•ด ์ ์ ˆํ•œ Animator๋ฅผ ์„ ํƒํ•˜๋Š” ๊ฐ€์ด๋“œ๋ฅผ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์ˆœ์ฐจ์ (์—ฌ๋Ÿฌ ๊ฐœ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ฐจ๋ก€๋Œ€๋กœ ์‹คํ–‰)

๋™์‹œ์ (์—ฌ๋Ÿฌ ๊ฐœ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ๋™์‹œ์— ์‹คํ–‰)

 

1. ํŠน๋ณ„ํžˆ ๊ด€๋ฆฌ๊ฐ€ ํ•„์š”์—†๊ณ  ํ•˜๋‚˜์˜ ๋ทฐ์—์„œ ์ˆœ์ฐจ์ , ๋™์‹œ์ , ๋ฐ˜๋ณต์ ์ธ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์•„๋‹Œ ๊ฐ„๋‹จํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ViewPropertAnimator๋ฅผ ์‚ฌ์šฉ

 

2. ํ•˜๋‚˜์˜ ๋ทฐ์—์„œ ๋ทฐ์˜ ๋ชจ๋“  ์†์„ฑ์„ ์ด์šฉํ•˜๋ฉฐ ์ˆœ์ฐจ์ , ๋™์‹œ์  ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์•„๋‹Œ ๊ฐ„๋‹จํ•˜๊ณ  ๋ฐ˜๋ณต์ ์ธ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ObjectAnimator๋ฅผ ์‚ฌ์šฉ

 

3. ํ•˜๋‚˜์˜ ๋ทฐ์—์„œ ๋™์‹œ์  ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด PropertyValueHolder๋ฅผ ์‚ฌ์šฉ

 

4. ๋ฐ˜๋ณต์ ์ด์ง€ ์•Š๊ณ  ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๋ทฐ๋“ค์— ์ˆœ์ฐจ์ , ๋™์‹œ์  ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด AnimatorSet์„ ์‚ฌ์šฉ

 

5. ๋ทฐ ๋˜๋Š” ๊ฐ์ฒด์˜ ์†์„ฑ์ด ์•„๋‹Œ ๊ฒƒ์— ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ ์šฉํ•˜๊ฑฐ๋‚˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์˜ ์ปค์Šคํ„ฐ๋งˆ์ด์ง•์„ ๊ทน๋Œ€ํ™” ํ•˜๊ณ ์‹ถ๋‹ค๋ฉด ValueAnimator๋ฅผ ์‚ฌ์šฉ

 

6. Shared Elemnet Transition์„ ๊ตฌํ˜„ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด Transitions์„ ์‚ฌ์šฉ

 

7. ์›€์ง์ด๋Š” ๋ฒกํ„ฐ ์•„์ด์ฝ˜์„ ๋งŒ๋“ค๊ณ  ์‹ถ๋‹ค๋ฉด AnimatedVectorDrawable ๋˜๋Š” Lottie๋ฅผ ์‚ฌ์šฉ


 

*fire-and-forget : ๋ฌด๊ธฐ ์šด์šฉ ์ฒด๊ณ„ ์ค‘, ๋ชฉํ‘œ๋ฅผ ํ•ญ์ƒ ์ง€์‹œํ•˜์ง€ ์•Š๊ณ , ๋ฐœ์‚ฌ ์‹œ ์ฒ˜์Œ์—๋งŒ ํƒ€๊ฒŸ์„ ์ง€์ •ํ•˜์—ฌ ๋ฏธ์‚ฌ์ผ์„ ๋‚ ๋ฆฌ๋ฉด ์•Œ์•„์„œ ํƒ€๊ฒŸ์„ ์ซ’์„๊ฑฐ๋ผ ๋ฏฟ๊ณ  ๋ฐœ์‚ฌ ํ›„ ์‹ ๊ฒฝ๋„๋Š” ๋ฐฉ์‹์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, ์ฒ˜๋ฆฌ ๊ฒฐ๊ณผ๋ฅผ ๊ฐ์‹œํ•˜๋‹ค ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ค๋ฉด ๋Šฅ๋™์ ์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹

 

*Shared Element Transition : Android 5.0 (Lolipop : API 21) ๋ถ€ํ„ฐ ๋‚˜์˜จ ๊ฐœ๋…์œผ๋กœ, Activity๋ฅผ ์ „ํ™˜ํ•  ๋•Œ View๋ฅผ ๋งˆ์น˜ ๊ณต์œ ํ•˜๋Š” ๊ฒƒ ๊ฐ™์€ ๋Š๋‚Œ์œผ๋กœ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ๋ฅผ ์ฃผ๋Š” ๊ธฐ๋ฒ•์ž…๋‹ˆ๋‹ค.


https://seosh817.tistory.com/18

 

[Android] Animation ์ •๋ฆฌ

์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์ด ์—ฌ๋Ÿฌ๊ฐ€์ง€๊ฐ€ ์กด์žฌํ•˜๋Š”๋ฐ, ๋ณตํ•ฉ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋ฉด ๋‹ค์–‘ํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์—ฐ์ถœ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Translate ์• ๋‹ˆ๋ฉ”์ด์…˜ translate ์• ๋‹ˆ๋ฉ”์ด์…˜์€ X, Y์ถ•์œผ๋กœ ์ด๋™

seosh817.tistory.com

 

https://medium.com/mj-studio/%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-%EC%95%A0%EB%8B%88%EB%A9%94%EC%9D%B4%EC%85%98-%EB%8F%8C%EC%9E%94%EC%B9%98-part-1-feca04af34dc

 

์•ˆ๋“œ๋กœ์ด๋“œ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋Œ์ž”์น˜ Part 1

์‹œ์ค‘์— ์กด์žฌํ•˜๋Š” ๋งŽ์€ ์•ฑ๋“ค์€ ๊ฒฐ์ฝ” ์ •์ ์ธ ์Šคํฌ๋ฆฐ์œผ๋กœ ์œ ์ €์˜ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ 100% ์ถฉ์กฑ์‹œ์ผœ์ฃผ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋งค๋„๋Ÿฝ์ง€๋งŒ ์ ˆ์ œ๋œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ํ†ตํ•ด ์œ ์ €๋“ค์—๊ฒŒ ๋” ๋‚˜์€ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜๊ณผ ์ง๊ด€์ ์ธ ์•ฑ

medium.com

 

https://fornewid.medium.com/android-ui%EC%97%90-animation-%EB%93%A4%EC%9D%B4%EB%B6%93%EA%B8%B0-e95cabbb517c

 

Android UI์— Animation ๋“ค์ด๋ถ“๊ธฐ

2020 ๋“œ๋กœ์ด๋“œ๋‚˜์ด์ธ ์—์„œ ๋ฐœํ‘œํ•œ ๋‚ด์šฉ์„ ๊ธ€๋กœ ์˜ฎ๊ฒผ์Šต๋‹ˆ๋‹ค. ์ตœ๊ทผ ๋งŽ์€ ์•ฑ๋“ค์ด minSdk 21 ์ด์ƒ์œผ๋กœ ๋ฐ”๋€Œ๊ณ  ์žˆ๋Š”๋ฐ์š”. Android UI Animation์„ ์ ์šฉํ•˜๊ธฐ์— ์ ๊ธฐ๊ฐ€ ์•„๋‹๊นŒ ์‹ถ์Šต๋‹ˆ๋‹ค. ์‹œ์ž‘ํ•˜๋Š”๋ฐ ๋„์›€์ด ๋ ๋งŒ

fornewid.medium.com

 

https://github.com/lgvalle/Material-Animations

 

GitHub - lgvalle/Material-Animations: Android Transition animations explanation with examples.

Android Transition animations explanation with examples. - GitHub - lgvalle/Material-Animations: Android Transition animations explanation with examples.

github.com

 

https://giantsol.github.io/android-animations/

 

์•ˆ๋“œ๋กœ์ด๋“œ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ api ์ •๋ฆฌ - Hansol’s Blog

์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ•์€ ์ •๋ง ๋‹ค์–‘ํ•˜๋‹ค.๋„ˆ๋ฌด ๋‹ค์–‘ํ•ด์„œ ๋ญ˜ ์จ์•ผํ• ์ง€ ์„ ํƒ ์žฅ์• ๊ฐ€ ์˜ฌํ…๋ฐ, ์•ˆ๋“œ๋กœ์ด๋“œ ํŒ€๋„ ๊ทธ๊ฑธ ์•Œ์•„์„œ ๊ทธ๋Ÿฐ์ง€ ์ญ‰ ๋น„๋””์˜ค๋กœ ์ •๋ฆฌํ•ด ์ฃผ์—ˆ๋‹ค.์•„๋ž˜ ๋‚ด์šฉ

giantsol.github.io

 

 

https://shubham08gupta.medium.com/a-beginners-guide-to-implement-android-animations-part-1-2-part-series-b5fce1fc85

 

A beginners guide to implement Android Animations — Part 1 (2 part series)

Admit it, you always wanted to create visually appealing apps. But due to functionality first approach, animations were always…

shubham08gupta.medium.com

 

https://www.crocus.co.kr/1690

 

[Android] ์–ธ์ œ ์–ด๋–ค Animator๋ฅผ ์‚ฌ์šฉํ•  ๊ฒƒ์ธ๊ฐ€?

Animation in Android ์•ˆ๋“œ๋กœ์ด๋“œ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ํ•˜๋‹ค ๋ณด๋ฉด ์ดˆ๋ผํ•œ UI๋ฅผ ์ œ๊ณตํ•˜์ง€ ์•Š๊ธฐ ์œ„ํ•ด ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ถ”๊ฐ€ํ•˜์—ฌ ์ข€ ๋” ๊ณ ๊ธ‰์Šค๋Ÿฌ์šด App์„ ๋งŒ๋“ค์–ด ๋‚ด๊ณ ์ž ํ•œ๋‹ค. ์ด๋•Œ Animation์„ ์“ฐ๋‹ค๋ณด๋ฉด ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋งŽ์€

www.crocus.co.kr

 

https://velog.io/@tltty123/Android-ValueAnimator

 

Android ValueAnimator

Value Animator๋ž€, ์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์ œ๊ณตํ•˜๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜ API ์ค‘ ํ•˜๋‚˜ ์ž…๋‹ˆ๋‹ค.propertyName์„ ์ง€์ •ํ•˜๊ณ  ํ•ด๋‹น property๋ฅผ ๊ฐ€์ง„ ๊ฐ์ฒด์—๋งŒ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ ์šฉ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋˜ ObjectAnimator์™€๋Š” ๋‹ค๋ฅด๊ฒŒ ๋ชจ๋“  ๊ฐ์ฒด์™€

velog.io

 

https://velog.io/@tltty123/Android-ObjectAnimator

 

Android ObjectAnimator

์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ์ œ๊ณตํ•˜๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜ ๊ตฌํ˜„ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋‚˜ ์ž…๋‹ˆ๋‹ค.์ „ ํฌ์ŠคํŠธ์—์„œ ๋‹ค๋ค˜๋˜ View Animation(Tween)๋ณด๋‹ค ๋‚˜์ค‘์— ๋‚˜์˜จ ์• ๋‹ˆ๋ฉ”์ด์…˜ API ์ž…๋‹ˆ๋‹ค.Tween์—์„œ๋Š” anim ๋””๋ ‰ํ† ๋ฆฌ์— ์ •์˜ํ•˜๊ณ  ์‚ฌ์šฉํ–ˆ์ง€๋งŒ,

velog.io