Slide 1

Slide 1 text

Adaptive Design #3 CyberAgent, Inc. ߱໼ େ஍

Slide 2

Slide 2 text

About Me Daichi Furiya @wasabeef_jp wasabeef http://wasabeef.jp

Slide 3

Slide 3 text

Shadows

Slide 4

Slide 4 text

• Viewͷܗʹ߹͏Α͏ʹShadowΛഎܠʹམͱ͢! In the shape of its outline! ! • ਖ਼౤Ө! Use scaleX/scaleY when perspective scaling desired! ! • translationX,Yͱಉ༷ʹ؆୯ͳΞχϝʔγϣϯ! view.animate().translationZ(value) Shadows!

Slide 5

Slide 5 text

public boolean onTouchEvent(MotionEvent event) { ! switch (event.getAction()) { case MotionEvent.ACTION_DOWN: animate().setDuration(100).scaleX(1.2f).scaleY(1.2f).translationZ(20); return true; ! case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: animate().setDuration(100).scaleX(1).scaleY(1).translationZ(0); return true; } } Shadows! How to use them

Slide 6

Slide 6 text

Umbra Penumbra

Slide 7

Slide 7 text

Shadows! Tip • 3Dճస࣌ͷShadow͸೉͍͠! rotateX, rotateY! ! • ଞViewͱͷ઀৮࣌ͷShadowҙࣝ͢Δ! ! • ElevationΛద੾ͳߴ͞ʹઃఆ͞Ε͍ͯΔ͜ͱ

Slide 8

Slide 8 text

• define animations between view states! ! • Raise pressed items! ! • State list animators! ! • Simply animate the elevation Animation Shadows

Slide 9

Slide 9 text

Animation Shadows

Slide 10

Slide 10 text

! ! ! ! ! ! ! Animation Shadows

Slide 11

Slide 11 text

StateListAnimator anim = ! AnimatorInflater.loadStateListAnimator(! context, R.anim.button_raise);! ! v.setStateListAnimator(anim); Animation Shadows

Slide 12

Slide 12 text

Path Tracing

Slide 13

Slide 13 text

Path Tracing • Works from ! API level 1 to API level 21! PathMeasure.getSegment(…)! ! • Easier with property animations

Slide 14

Slide 14 text

Path path = makePath();! Path renderPath = new Path();! ! // Measure the path! PathMeasure measure = new PathMeasure(path, false);! float length = measure.getLength();! ! // Get a path segment! measure.getSegment(! 0.0f, fraction * length, renderPath, true);! ! // For Android <= 4.4! renderPath.rLineTo(0.0f, 0.0f);! canvas.drawPath(renderPath, paint); Path Tracing

Slide 15

Slide 15 text

public void tracePath() {! ! ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);! ! animator.addUpdateListener(new AnimatorUpdateListener() {! @Override! public void onAnimationUpdate(ValueAnimator valueAnimator) {! ! measure.getSegment(0.0f, mPathLength *! (Float) valueAnimator.getAnimatedValue(), renderPath, true);! ! invalidate();! ! }! });! animator.start();! } Path Tracing

Slide 16

Slide 16 text

Colors

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Palette! • android-support-v7-palette! ! ! • Bitmap͔ΒPaletteΛGenerate͢Δ! 6 named colors

Slide 19

Slide 19 text

private void colorize(Bitmap photo) {! // You can also use async versions! Palette p = Palette.generate(photo);! ! TextView titleView = ! (TextView) findViewById(R.id.title);! titleView.setTextColor(p.getVibrantColor().getRgb());! } Dynamic Palette! android.support.v7.graphics.Palette

Slide 20

Slide 20 text

Material Design ≒ Adaptive Design

Slide 21

Slide 21 text

Thanks.