Upgrade to Pro — share decks privately, control downloads, hide ads and more …

はじめてのKenBurnsEffect

 はじめてのKenBurnsEffect

第14回 potatotips (iOS/Android開発Tips共有会) での発表資料

4933bd389dcebd6a5715dc45fdae2d96?s=128

Yoichi Nishimura

February 18, 2015
Tweet

Transcript

  1. ͸͡Ίͯͷ,FO#VSOT&⒎FDU OJTTJZ

  2. "CPVU.F w OJTTJZʢʹͬ͠ʔʣ
 !ZPJDIJOJTIJNVSB!OJTTJZ w 7"4*-: JOD w J20/࡞͍ͬͯ·͢ w

    झຯ͸өըؑ৆
  3. ,FO#VSOT&⒎FDUʁʁʁ

  4. ,FO#VSOT&⒎FDU w υΩϡϝϯλϦʔөըͷ؂ಜ
 ,FO#VSOTʢ!LFOCVSOTʣ͕ଟ༻͢Δ
 ύϯɾνϧτͱζʔϜΛ૊Έ߹Θٕͤͨ๏ w ੩ࢭըʹಈ͖Λ༩͑ΔޮՌ͕͋Γ·͢ w (PPHMF1MBZχϡʔεελϯυͷΞϨ IUUQKBXJLJQFEJBPSHXJLJέϯɾόʔϯζ

  5. ,FO#VSOT7JFX࡞Γ·ͨ͠

  6. 'SBNF-BZPVUΛܧঝͨ͠$VTUPN7JFX public class KenBurnsView extends FrameLayout { private boolean mDebugLog

    = false; private String mDebugTag = “KenBurnsView";
  7. ࢖͍΍͍͢ΠϯλϑΣʔε @InjectView(R.id.ken_burns_effect) KenBurnsView mKenBurnsEffect; private void startKenBurnsEffect(String... urls) { mKenBurnsEffect.setUrls(urls);

    } w "DUJWJUZʢ'SBHNFOUʣ͔Β63-PSϦιʔε*%Λ഑ྻͰ౉͚ͩ͢
  8. ͋ͱ͸ࣗಈʹΞχϝʔγϣϯ @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mHandler.removeCallbacks(mAnimationRunnable); } w

    ը૾ͷಡΈࠐΈ͕׬ྃͨ͠ΒΞχϝʔγϣϯ։࢝ w PO%FUBDIFE'SPN8JOEPX ͰΞχϝʔγϣϯऴྃ
  9. Ξχϝʔγϣϯ͸7JFX1SPQFSUZ"OJNBUPSͰ // Ξχϝʔγϣϯͷॳظঢ়ଶ΋ϥϯμϜͰੜ੒͠ɺ͜ͷલͰઃఆ͢Δ ViewPropertyAnimator animator = view.animate() .translationX(toTranslationX) .translationY(toTranslationY) .scaleX(toScale)

    .scaleY(toScale) .setDuration(duration); animator.start(); w ը૾αΠζͱཚ਺Λ࢖ͬͯ4DBMFͱ5SBOTMBUJPOΛܾఆͤ͞Δ w ͦͷ৘ใΛ࢖ͬͯ7JFX1SPQFSUZ"OJNBUPSͰΞχϝʔγϣϯ
  10. ̏ ̎ ը૾ͷݟͤํʢ/ͷ৔߹ʣ ̍ ࣌ؒͷྲྀΕ ̏ ̎ ̍ ̏ ̎

    ̍ w ֤૚ͷը૾ͷBMQIBΛ͍ͬͯ͡ը૾͕ೖΕସΘΔΑ͏ʹݟ͍ͤͯΔ
  11. ͜ΕͰ,FO#VSOT7JFX͕࡞ΕΔͰʂ εϚϗΞϓϦʹԶͷ໊͕ڹ͖౉ΔΜ΍ʂ

  12. طʹJ20/Ͱ࢖͍ͬͯ·͢ w J20/ͷϒϥϯυϖʔδͰ࣮૷ w ֤ϒϥϯυͷϞσϧೖΓը૾͔Β఺Λදࣔ
 ෺ࡱΓͷΈͷϒϥϯυ͸ਓؾΞΠςϜͰิర

  13. ΍Γ͍ͨ͜ͱ w େ͖͍ը૾͕౉͞Εͨࡍͷ00.ରࡦΛೖΕΔ w ը૾ͷऔಘॲཧ͕Πέͯͳ͍ͷͰ௚͢ w Ξχϝʔγϣϯ։࢝ޙʹ63-PSϦιʔε*%Λ
 ड͚औΕΔΑ͏ʹͯ͠ಈతʹը૾Λࠩ͠ସ͑ΒΕΔΑ͏ʹ͢Δ w ֎෦ϥΠϒϥϦԽͯ͠ެ։

  14. ͍͞͝ʹ w εϚϗΞϓϦʹөըͷٕ๏͕౤ೖ͞Ε͸͡Ί͍ͯΔ
 48:FBSͳͷͰ++"CSBNTͷϨϯζϑϨΞͱ͔དྷΔ͔΋X w ,FO#VSOT&⒎FDUΧοί͍͍ʂঁͷࢠ͔Βͷධ൑΋ྑ͍ʂ

  15. ͋Γ͕ͱ͏͍͟͝·ͨ͠