SlideShare a Scribd company logo
1 of 60
Download to read offline
スマートフォン時代のWeb制作術 Vol.1




                   2013年2月6日
                   WAVE新宿本校
                   原 一成 @herablog
スマートフォン
PV数 (億PV)
150

                                                                                                                                133

                                                                                                                          120
                                                                                                                    109
                                                                                                           104103
                                                                                                      99
100
                                                                                                 91
                                                                                            85
                                                                                       76
                                                                                  67
                                                                             61

 50                                                                  45 47
                                                                35
                                                        28 30
                                                20 21
                                           17
                                    13
                       7   9   9 11
           3   3   5
       2
  0
      10.1011 12 11.1 2    3   4   5   6   7    8   9 10 11 12 12.1 2        3    4    5    6    7    8     9 10 11 12 13.1
@herablog
PV数 (億PV)
150

                                                                                                                                133

                                                                                                                          120
                                                                                                                    109
                                                                                                           104103
                                                                                                      99
100
                                                                                                 91
                                                                                            85
                                                                                       76
                                                                                  67
                                                                             61

 50                                                                  45 47
                                                                35
                                                        28 30
                                                20 21
                                           17
                                    13
                       7   9   9 11
           3   3   5
       2
  0
      10.1011 12 11.1 2    3   4   5   6   7    8   9 10 11 12 12.1 2        3    4    5    6    7    8     9 10 11 12 13.1
PV数 (億PV)
150

                                                                                                                                133

                                                                                                                          120
                                                                                                                    109
                                                                                                           104103
                                                                                                      99
100
                                                                                                 91
                                                                                            85
                                                                                       76
                                                                                  67
                                                                             61

 50                                                                  45 47
                                                                35
                                                        28 30
                                                20 21
                                           17
                                    13
                       7   9   9 11
           3   3   5
       2
  0
      10.1011 12 11.1 2    3   4   5   6   7    8   9 10 11 12 12.1 2        3    4    5    6    7    8     9 10 11 12 13.1
@herablog




HTML/CSS/JavaScript
@herablog




@herablog
スマートフォン
役割の変化




            Front      Server
Designer
           Engineer   Engineer
役割の変化




            Front      Server
Designer
           Engineer   Engineer
役割の変化




            Front      Server
Designer
           Engineer   Engineer
役割の変化



Front Engineer

 ・プログラム知識
 ・サーバー知識
 ・モジュール/コンポーネント化
 ・コマンドライン操作
スマートフォン
スマートフォン




   HTML5/CSS3


   JavaScript


   パフォーマンス
スマートフォン




   HTML5/CSS3


   JavaScript


   パフォーマンス
Selectors API




・セレクタで楽に要素を取得
・意外と知られていない
・普段はライブラリで吸収
Selectors API

HTML
<div id=”main” data-id=”1”>
  <p class=”title”>Title</p>
</div>

JavaScript
document.getElementById(‘main’);
$(‘#main’);
document.querySelector(‘#main’);
document.querySelectorAll(‘[data-id]’);
document.querySelectorAll(‘.title’);
Canvas




・比較的高い互換性
・JSから操作可能
・複雑な動作は一択か
Canvas



HTML
<canvas id=”canvas”></canvas>


JavaScript
var canvas = document.getElementById(‘canvas’);
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.moveTo(10, 10);
ctx.lineTo(100, 10);
ctx.closePath();
Canvas
Canvas
CSS: transform




・CSSによる変形処理
・回転、拡大、マトリックスなど多様
・JSと組み合わせアニメーションも
CSS: transform



<div data-parts=”f_body” style=”-webkit-
transform: matrix(0.1, 0, 0, 0.1, 1.8,
-43.7);”>
  <img src=”data:~~”>
</div>


<div data-parts=”f_body” style=”-webkit-
transform: matrix(0.99, 0, 0, 0.99, 0.75,
-40.5);”>
  <img src=”data:~~”>
</div>
Audio




・ブラウザ単体で音が出せる
・スマートフォンと相性がいい
・ユーザーのアクション時のみ再生
・同時に鳴らせるのは1ファイルだけ
Audio



HTML
<audio id=”audio”>
  <source src=”audio”>
</audio>

JavaScript
var audio = document.getElementById(‘audio’);
audio.loop = false;
audio.play();
Audio
Local Storage


・JSから簡単にアクセス
・Cookieと違いサーバに送られない
・実際にはstringしか入れられない
・容量オーバーに注意
・非対応端末(UIWebview含)あり
・超一時的なものはメモリで
Local Storage




JavaScript
var obj = {‘name’:‘val”};
localStorage.setItem(‘key’, JSON.stringify(obj));
var data = JSON.parse(localStorage.getItem(‘key’));
Web Font




・デザイン性が増す
・ベクターなのでマルチデバイス◎
・複数の種類に対応する必要あり
・アイコンに使うこともできる
Web Font
Web Font


@font-face {
    font-family: "AmebaSymbols";
    src:url("../font/ameba_symbols.eot");
    src:url("../font/ameba_symbols.woff")
format('woff'),
          url("../font/ameba_symbols.ttf")
format('truetype'),
          url("../font/ameba_symbols.svg#webfont")
format('svg')
}


.icon {    font-family: "AmebaSymbols";     }
.icon.M::before { content: "M" }
Can I use...




http://caniuse.com/
スマートフォン




   HTML5/CSS3


   JavaScript


   パフォーマンス
大規模化


javascripts

main.js

core.js

application.js

top.js
JSライブラリ
JSライブラリ
JSライブラリ




  軽量


  MVCフレームワーク
JS独自ライブラリ




                chikuwa.js
                chikuwa-view.js
                chikuwa-dispatcher.js


https://github.com/ameba-proteus/chikuwa.js
chikuwa.js



40

                            32KB
30


20

     7KB          10KB
10


 0
     chikuwa       zepto    jQuery
テンプレートエンジン



Chikuwa                            HTML
var notiCount = getNotiCount();    <header>
tag( header )                        <button class= menu ></button>
  .tag( button.menu ).gat()          <h1>Ameba</h1>
  .tag( h1 ).text( Ameba ).gat()     <button class= noti >
  .tag( button.noti )                  <span class= counter >1</span>
    .tag( span.counter )             </button>
       .text(notiCount).gat()      </header>
  .gat();
View & Routing


View                                     Routing
$.views({                                $.routes( group , {
      group.top : {                            /:              {name: top , action: top },
          init: function(data) {               /:groupId/info : {name: info , action: info }
               this.data = data ¦¦ {};   });
          },
          render: function() {           Action
               return tag( div );        function top(vars) {
          }                                    var view = $.view( group.top );
      }                                        page.replace(view);
});                                      }
モジュール別開発



メッセージ          サークル
message.js     circle.js
message.css    circle.css


プロフィール         掲示板
profile.js      board.js
profile.css     board.css
node.js




  スケーラブル


  非同期


  JavaScriptである
node.js




  スケーラブル


  非同期


  JavaScriptである
役割の変化




            Front      Server
Designer
           Engineer   Engineer
Ameba
アーキテクチャ
アーキテクチャ

 Front           Server
Engineer        Engineer
アーキテクチャ

 Front      Server
Engineer   Engineer
スマートフォン




   HTML5/CSS3


   JavaScript


   パフォーマンス
パフォーマンス




・スマートフォンのネックは回線
・リクエスト数と転送量を減らす
Minify

Before
/**
* chikuwa.js
* Copyright (c) 2011 CyberAgent, Inc.
* License: MIT (http://www.opensource.org/licenses/mit-license)
* GitHub: https://github.com/suguru/chikuwa.js
*/
(function(w) {
      var doc = w.document,
      root = w.document.documentElement,
      cssnum = {'column-count':1,columns:1,'font-weight': 1,'line-height':1,opacity:1,'z-index':1,zoom:1},
      slice = Array.prototype.slice;


      // is string
      function isString(o) { return typeof o === 'string' ¦¦ o instanceof String; }
      // is function
      function isFunction(o) { return typeof o === 'function' ¦¦ o instanceof Function; }
      // is number
      function isNumber(o) { return typeof o === 'number' ¦¦ o instanceof Number; }
      // is chikuwa object
      function isChikuwa(o) { return o instanceof chikuwa; }
      // is object
      function isObject(o) { return o instanceof Object; }
Minify

After
(function(e){function s(e){return typeof e=="string"¦¦e instanceof String}function o(e){return typeof
e=="function"¦¦e instanceof Function}function u(e){return typeof e=="number"¦¦e instanceof Number}
function a(e){return e instanceof T}function f(e){return e instanceof Object}function l(e){return e
instanceof Array}function c(e){return e===undefined¦¦e===null}function h(e){for(var t in e)return!
1;return!0}function p(e){return c(e)?"":e}function d(e){return e.replace(/-([a-z])/g,function(e){return
e.toUpperCase().replace("-","")})}function v(e){return e.replace(/([A-Z])/g,function(e)
{return"-"+e.toLowerCase()})}function m(e,t){return u(t)&&c(r[e])?t+"px":t}function g(e){var t={};for(var
n=0;n<e.length;n++)t[e[n]]=1;return t}function y(e){return e?e.replace(/^¥s+¦¥s+$/g,""):""}function b(e)
{return tag("span").text(e).inner()}function w(e,t,n){if(!n)return;["-webkit-"+t,"-moz-"+t,"-ms-"+t,"-
o-"+t,t].forEach(function(t){e[t]=n})}function S(e){return e._cid¦¦(e._cid=++E)}function x(e,t,n){try{var
r=new Event(e);r.target=t;return r}catch(i){var s=t instanceof T?
t.get(0):null;return{type:e,target:t,currentTarget:s,custom:!0,source:n,stopPropagation:function()
{n&&n.stopPropagation()},preventDefault:function(){n&&n.preventDefault()}}}}function T(e,t){s(e)?
this.c=t.querySelectorAll(e):l(e)?this.c=e:this.c=[e]}function N(e){return c(e)?null:e instanceof T?e:new
T(e,t)}function k(e){return e in C?C[e]:e}function M(e,t,n){this.count=0;this.loop=t¦¦0;this.interval=e¦¦
0;this.delay=n¦¦0;this.timerId=0}function D(e,t){var n=(new Error).stack;if(n){var r=n.split(/
¥n/),i=r[3];if(i){var s=_.exec(i);if(s){var o=s[1];t.push("("+o+")")}}}t.unshift("["+e+"]");N.os.ios¦¦
N.os.android?console.log(t.join(" ")):console.log.apply(console,t)}function H(){}var
t=e.document,n=e.document.documentElement,r={"column-count":1,columns:1,"font-weight":1,"line-
height":1,opacity:1,"z-index":1,zoom:
1},i=Array.prototype.slice,E=0,C={added:"DOMNodeInsertedIntoDocument",removed:"DOMNodeRemo
vedFromDocument"};T.prototype={constructor:T,length:function(){return this.c.length},exist:function(e)
{var t=this.c;return e>=0&&e<t.length&&(l(t)?!c(t[e]):!c(t.item(e)))},get:function(e){return l(this.c)?
結合

chikuwa.js                                                         chikuwa-view.js
(function(e){function s(e){return typeof e=="string"¦¦e            (function(e){function u(e){}function l(e,t){n.info("define
instanceof String}function o(e){return typeof                      view class",e,t);var i=t.extend?r[t.extend]:u,s=function()
e=="function"¦¦e instanceof Function}function u(e)                 {};s.prototype=i.prototype;var o=function(t)
{return typeof e=="number"¦¦e instanceof Number}                   {this.__name=e;this.__init(t)};o.prototype=new s;o.proto



main.js                                                            chikuwa-dispatcher.js
(function(e){function s(e){return typeof e=="string"¦¦e            (function(e){function u(e){}function l(e,t){n.info("define
instanceof String}function o(e){return typeof                      view class",e,t);var i=t.extend?r[t.extend]:u,s=function()
e=="function"¦¦e instanceof Function}function u(e)                 {};s.prototype=i.prototype;var o=function(t)
{return typeof e=="number"¦¦e instanceof Number}                   {this.__name=e;this.__init(t)};o.prototype=new s;o.proto




                                     all.js
                                    (function(e){function s(e){return typeof e=="string"¦¦e
                                    instanceof String}function o(e){return typeof
                                    e=="function"¦¦e instanceof Function}function u(e)
                                    {return typeof e=="number"¦¦e instanceof Number}
gzip転送




約70%削減
注意




容量注意
Google Speed




https://developers.google.com/speed/pagespeed/insights   Google Chrome, Firefox
Chrome Developer Tools




Developer Toolsを制すものはDebugを制す!
スマートフォン時代のWeb制作術 Vol.1

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

スマートフォン時代のWeb制作術 Vol.1