找回密码
 立即注册
查看: 408|回复: 0

[简易教程] 机器长宽比,屏幕适配

[复制链接]
发表于 2022-1-7 15:32 | 显示全部楼层 |阅读模式

var data = [{"Family & Model":"iPhone 13","Logical Width":"390","Logical Height":"844","Physical Width":"1170","Physical Height":"2532","PPI":"460","Scale Factor":"3","Screen Diagonal":"6.06","Release":"2021/9/14"},
    {"Family & Model":"iPhone 13 mini","Logical Width":"375","Logical Height":"812","Physical Width":"1080","Physical Height":"2340","PPI":"476","Scale Factor":"3","Screen Diagonal":"5.42","Release":"2021/9/14"},
    {"Family & Model":"iPhone 13 Pro Max","Logical Width":"428","Logical Height":"926","Physical Width":"1284","Physical Height":"2778","PPI":"458","Scale Factor":"3","Screen Diagonal":"6.68","Release":"2021/9/14"},
    {"Family & Model":"iPhone 13 Pro","Logical Width":"390","Logical Height":"844","Physical Width":"1170","Physical Height":"2532","PPI":"460","Scale Factor":"3","Screen Diagonal":"6.06","Release":"2021/9/14"},
    {"Family & Model":"iPhone 12","Logical Width":"390","Logical Height":"844","Physical Width":"1170","Physical Height":"2532","PPI":"460","Scale Factor":"3","Screen Diagonal":"6.06","Release":"2020/10/13"},
    {"Family & Model":"iPhone 12 mini","Logical Width":"375","Logical Height":"812","Physical Width":"1080","Physical Height":"2340","PPI":"476","Scale Factor":"3","Screen Diagonal":"5.42","Release":"2020/10/13"},
    {"Family & Model":"iPhone 12 Pro Max","Logical Width":"428","Logical Height":"926","Physical Width":"1284","Physical Height":"2778","PPI":"458","Scale Factor":"3","Screen Diagonal":"6.68","Release":"2020/10/13"},
    {"Family & Model":"iPhone 12 Pro","Logical Width":"390","Logical Height":"844","Physical Width":"1170","Physical Height":"2532","PPI":"460","Scale Factor":"3","Screen Diagonal":"6.06","Release":"2020/10/13"},
    {"Family & Model":"iPhone SE 2nd gen","Logical Width":"375","Logical Height":"667","Physical Width":"750","Physical Height":"1334","PPI":"326","Scale Factor":"2","Screen Diagonal":"4.7","Release":"2020/4/24"},
    {"Family & Model":"iPhone 11 Pro Max","Logical Width":"414","Logical Height":"896","Physical Width":"1242","Physical Height":"2688","PPI":"458","Scale Factor":"3","Screen Diagonal":"6.46","Release":"2019/9/20"},
    {"Family & Model":"iPhone 11 Pro","Logical Width":"375","Logical Height":"812","Physical Width":"1125","Physical Height":"2436","PPI":"458","Scale Factor":"3","Screen Diagonal":"5.85","Release":"2019/9/20"},
    {"Family & Model":"iPhone 11","Logical Width":"414","Logical Height":"896","Physical Width":"828","Physical Height":"1792","PPI":"326","Scale Factor":"2","Screen Diagonal":"6.1","Release":"2019/9/20"},
    {"Family & Model":"iPhone XR","Logical Width":"414","Logical Height":"896","Physical Width":"828","Physical Height":"1792","PPI":"326","Scale Factor":"2","Screen Diagonal":"6.06","Release":"2018/10/26"},
    {"Family & Model":"iPhone XS Max","Logical Width":"414","Logical Height":"896","Physical Width":"1242","Physical Height":"2688","PPI":"458","Scale Factor":"3","Screen Diagonal":"6.46","Release":"2018/9/21"},
    {"Family & Model":"iPhone XS","Logical Width":"375","Logical Height":"812","Physical Width":"1125","Physical Height":"2436","PPI":"458","Scale Factor":"3","Screen Diagonal":"5.85","Release":"2018/9/21"},
    {"Family & Model":"iPhone X","Logical Width":"375","Logical Height":"812","Physical Width":"1125","Physical Height":"2436","PPI":"458","Scale Factor":"3","Screen Diagonal":"5.85","Release":"2017/11/3"},
    {"Family & Model":"iPhone 8 Plus","Logical Width":"414","Logical Height":"736","Physical Width":"1080","Physical Height":"1920","PPI":"401","Scale Factor":"3","Screen Diagonal":"5.5","Release":"2017/9/22"},
    {"Family & Model":"iPhone 8","Logical Width":"375","Logical Height":"667","Physical Width":"750","Physical Height":"1334","PPI":"326","Scale Factor":"2","Screen Diagonal":"4.7","Release":"2017/9/22"},
    {"Family & Model":"iPhone 7 Plus","Logical Width":"476","Logical Height":"847","Physical Width":"1242","Physical Height":"2208","PPI":"401","Scale Factor":"3","Screen Diagonal":"5.5","Release":"2016/9/16"},
    {"Family & Model":"iPhone 7","Logical Width":"375","Logical Height":"667","Physical Width":"750","Physical Height":"1334","PPI":"326","Scale Factor":"2","Screen Diagonal":"4.7","Release":"2016/9/16"},
    {"Family & Model":"iPhone SE 1st gen","Logical Width":"320","Logical Height":"568","Physical Width":"640","Physical Height":"1136","PPI":"326","Scale Factor":"2","Screen Diagonal":"4","Release":"2016/3/31"},
    {"Family & Model":"iPhone 6s Plus","Logical Width":"476","Logical Height":"847","Physical Width":"1242","Physical Height":"2208","PPI":"401","Scale Factor":"3","Screen Diagonal":"5.5","Release":"2015/9/25"},
    {"Family & Model":"iPhone 6s","Logical Width":"375","Logical Height":"667","Physical Width":"750","Physical Height":"1334","PPI":"326","Scale Factor":"2","Screen Diagonal":"4.7","Release":"2015/9/25"},
    {"Family & Model":"iPhone 6 Plus","Logical Width":"476","Logical Height":"847","Physical Width":"1242","Physical Height":"2208","PPI":"401","Scale Factor":"3","Screen Diagonal":"5.5","Release":"2014/9/19"},
    {"Family & Model":"iPhone 6","Logical Width":"375","Logical Height":"667","Physical Width":"750","Physical Height":"1334","PPI":"326","Scale Factor":"2","Screen Diagonal":"4.7","Release":"2014/9/19"},
    {"Family & Model":"iPhone 5C","Logical Width":"320","Logical Height":"568","Physical Width":"640","Physical Height":"1136","PPI":"326","Scale Factor":"2","Screen Diagonal":"4","Release":"2013/9/20"},
    {"Family & Model":"iPhone 5S","Logical Width":"320","Logical Height":"568","Physical Width":"640","Physical Height":"1136","PPI":"326","Scale Factor":"2","Screen Diagonal":"4","Release":"2013/9/20"},
    {"Family & Model":"iPhone 5","Logical Width":"320","Logical Height":"568","Physical Width":"640","Physical Height":"1136","PPI":"326","Scale Factor":"2","Screen Diagonal":"4","Release":"2012/9/21"},
    {"Family & Model":"iPhone 4S","Logical Width":"320","Logical Height":"480","Physical Width":"640","Physical Height":"960","PPI":"326","Scale Factor":"2","Screen Diagonal":"3.5","Release":"2011/10/14"},
    {"Family & Model":"iPhone 4","Logical Width":"320","Logical Height":"480","Physical Width":"640","Physical Height":"960","PPI":"326","Scale Factor":"2","Screen Diagonal":"3.5","Release":"2010/6/21"},
    {"Family & Model":"iPhone 3GS","Logical Width":"320","Logical Height":"480","Physical Width":"320","Physical Height":"480","PPI":"163","Scale Factor":"1","Screen Diagonal":"3.5","Release":"2009/6/19"},
    {"Family & Model":"iPhone 3G","Logical Width":"320","Logical Height":"480","Physical Width":"320","Physical Height":"480","PPI":"163","Scale Factor":"1","Screen Diagonal":"3.5","Release":"2008/7/11"},
    {"Family & Model":"iPhone 1st gen","Logical Width":"320","Logical Height":"480","Physical Width":"320","Physical Height":"480","PPI":"163","Scale Factor":"1","Screen Diagonal":"3.5","Release":"2007/6/29"},
    {"Family & Model":"iPad Mini (6th gen)","Logical Width":"744","Logical Height":"1133","Physical Width":"1488","Physical Height":"2266","PPI":"326","Scale Factor":"2","Screen Diagonal":"8.3","Release":"2019/3/18"},
    {"Family & Model":"iPad 9th gen","Logical Width":"810","Logical Height":"1080","Physical Width":"1620","Physical Height":"2160","PPI":"264","Scale Factor":"2","Screen Diagonal":"10.2","Release":"2021/9/14"},
    {"Family & Model":"iPad Pro (5th gen 12.9","Logical Width":"1024","Logical Height":"1366","Physical Width":"2048","Physical Height":"2732","PPI":"264","Scale Factor":"2","Screen Diagonal":"12.9","Release":"2021/5/21"},
    {"Family & Model":"iPad Pro (5th gen 11","Logical Width":"834","Logical Height":"1194","Physical Width":"1668","Physical Height":"2388","PPI":"264","Scale Factor":"2","Screen Diagonal":"11","Release":"2021/5/21"},
    {"Family & Model":"iPad Air (4th gen)","Logical Width":"820","Logical Height":"1180","Physical Width":"1640","Physical Height":"2360","PPI":"264","Scale Factor":"2","Screen Diagonal":"10.9","Release":"2020/10/23"},
    {"Family & Model":"iPad 8th gen","Logical Width":"810","Logical Height":"1080","Physical Width":"1620","Physical Height":"2160","PPI":"264","Scale Factor":"2","Screen Diagonal":"10.2","Release":"2020/9/18"},
    {"Family & Model":"iPad Pro (4th gen 12.9","Logical Width":"1024","Logical Height":"1366","Physical Width":"2048","Physical Height":"2732","PPI":"264","Scale Factor":"2","Screen Diagonal":"12.9","Release":"2020/3/25"},
    {"Family & Model":"iPad Pro (4th gen 11","Logical Width":"834","Logical Height":"1194","Physical Width":"1668","Physical Height":"2388","PPI":"264","Scale Factor":"2","Screen Diagonal":"11","Release":"2020/3/25"},
    {"Family & Model":"iPad 7th gen","Logical Width":"810","Logical Height":"1080","Physical Width":"1620","Physical Height":"2160","PPI":"264","Scale Factor":"2","Screen Diagonal":"10.2","Release":"2019/9/25"},
    {"Family & Model":"iPad Mini (5th gen)","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"326","Scale Factor":"2","Screen Diagonal":"7.9","Release":"2019/3/18"},
    {"Family & Model":"iPad Air (3rd gen)","Logical Width":"834","Logical Height":"1112","Physical Width":"1668","Physical Height":"2224","PPI":"264","Scale Factor":"2","Screen Diagonal":"10.5","Release":"2019/3/18"},
    {"Family & Model":"iPad Pro (3rd gen 12.9","Logical Width":"1024","Logical Height":"1366","Physical Width":"2048","Physical Height":"2732","PPI":"264","Scale Factor":"2","Screen Diagonal":"12.9","Release":"2018/11/7"},
    {"Family & Model":"iPad Pro (3rd gen 11","Logical Width":"834","Logical Height":"1194","Physical Width":"1668","Physical Height":"2388","PPI":"264","Scale Factor":"2","Screen Diagonal":"11","Release":"2018/11/7"},
    {"Family & Model":"iPad 6th gen","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"264","Scale Factor":"2","Screen Diagonal":"9.7","Release":"2018/3/27"},
    {"Family & Model":"iPad Pro (2nd gen 12.9","Logical Width":"1024","Logical Height":"1366","Physical Width":"2048","Physical Height":"2732","PPI":"264","Scale Factor":"2","Screen Diagonal":"12.9","Release":"2017/6/13"},
    {"Family & Model":"iPad Pro (2nd gen 10.5","Logical Width":"834","Logical Height":"1112","Physical Width":"1668","Physical Height":"2224","PPI":"264","Scale Factor":"2","Screen Diagonal":"10.5","Release":"2017/6/13"},
    {"Family & Model":"iPad 5th gen","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"264","Scale Factor":"2","Screen Diagonal":"9.7","Release":"2017/3/24"},
    {"Family & Model":"iPad Pro (1st gen 9.7鈥)","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"264","Scale Factor":"2","Screen Diagonal":"9.7","Release":"2016/3/31"},
    {"Family & Model":"iPad Pro (1st gen 12.9","Logical Width":"1024","Logical Height":"1366","Physical Width":"2048","Physical Height":"2732","PPI":"264","Scale Factor":"2","Screen Diagonal":"12.9","Release":"2015/11/11"},
    {"Family & Model":"iPad mini 4","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"326","Scale Factor":"2","Screen Diagonal":"7.9","Release":"2015/9/9"},
    {"Family & Model":"iPad Air 2","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"326","Scale Factor":"2","Screen Diagonal":"9.7","Release":"2014/10/22"},
    {"Family & Model":"iPad mini 3","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"264","Scale Factor":"2","Screen Diagonal":"7.9","Release":"2014/10/22"},
    {"Family & Model":"iPad mini 2","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"326","Scale Factor":"2","Screen Diagonal":"7.9","Release":"2013/11/12"},
    {"Family & Model":"iPad Air","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"264","Scale Factor":"2","Screen Diagonal":"9.7","Release":"2013/11/1"},
    {"Family & Model":"iPad 4th gen","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"264","Scale Factor":"2","Screen Diagonal":"9.7","Release":"2012/11/12"},
    {"Family & Model":"iPad mini","Logical Width":"768","Logical Height":"1024","Physical Width":"768","Physical Height":"1024","PPI":"163","Scale Factor":"1","Screen Diagonal":"7.9","Release":"2012/11/2"},
    {"Family & Model":"iPad 3rd gen","Logical Width":"768","Logical Height":"1024","Physical Width":"1536","Physical Height":"2048","PPI":"264","Scale Factor":"2","Screen Diagonal":"9.7","Release":"2012/3/16"},
    {"Family & Model":"iPad 2","Logical Width":"768","Logical Height":"1024","Physical Width":"768","Physical Height":"1024","PPI":"132","Scale Factor":"1","Screen Diagonal":"9.7","Release":"2011/3/11"},
    {"Family & Model":"iPad 1st gen","Logical Width":"768","Logical Height":"1024","Physical Width":"768","Physical Height":"1024","PPI":"132","Scale Factor":"1","Screen Diagonal":"9.7","Release":"2010/4/3"},
    {"Family & Model":"iPod touch 6th gen","Logical Width":"320","Logical Height":"568","Physical Width":"640","Physical Height":"1136","PPI":"326","Scale Factor":"2","Screen Diagonal":"4","Release":"2015/7/15"},
    {"Family & Model":"iPod touch 5th gen","Logical Width":"320","Logical Height":"568","Physical Width":"640","Physical Height":"1136","PPI":"326","Scale Factor":"2","Screen Diagonal":"4","Release":"2012/10/11"},
    {"Family & Model":"iPod touch 4th gen","Logical Width":"320","Logical Height":"480","Physical Width":"640","Physical Height":"960","PPI":"326","Scale Factor":"2","Screen Diagonal":"3.5","Release":"2010/9/1"},
    {"Family & Model":"iPod touch 3rd gen","Logical Width":"320","Logical Height":"480","Physical Width":"320","Physical Height":"480","PPI":"163","Scale Factor":"1","Screen Diagonal":"3.5","Release":"2009/9/9"},
    {"Family & Model":"iPod touch 2nd gen","Logical Width":"320","Logical Height":"480","Physical Width":"320","Physical Height":"480","PPI":"163","Scale Factor":"1","Screen Diagonal":"3.5","Release":"2008/9/9"},
    {"Family & Model":"iPod touch 1st gen","Logical Width":"320","Logical Height":"480","Physical Width":"320","Physical Height":"480","PPI":"163","Scale Factor":"1","Screen Diagonal":"3.5","Release":"2007/9/5"}];


var min = Infinity;
var minData =null;
var max = -Infinity;
var maxData =null;
for (var i = 0, lenI = data.length; i < lenI; i++) {
    var ratio = data[i]["Logical Height"] / data[i]["Logical Width"];
    var n_min = Math.min(ratio, min);
    if (n_min != min) {
        min = n_min;
        minData = data[i];
    }
    var n_max = Math.max(ratio, max);
    if (n_max != max) {
        max = n_max;
        maxData=data[i];
    }
    console.log("长比宽:" + data[i]["Logical Height"] / data[i]["Logical Width"]);
}
console.log("max:" + max);
console.log("min:" + min);

/*

最长的iphone 13 mini 2340x1080 顶宽
用1560x960
显示区域1560*720(高除以1.5)

最高的ipad 9 2160x1620 顶高
用1560x960
显示区域1280*960(宽除以1.6875)

=============

普通机器normal可以设计为:1560x960 (竞品,按hud缩放的)
可见区域为1280x720
.

高端机hud为(normal*1.25)-<<<<<<<<<<<<<(美术按这个做,后期根据机型缩小):
设计按1950x1200
可见区域为1600x900
.

低端机low为(normal/2):780x480 (按hud缩放的)
可见区域为640x360

* */
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-21 21:59 , Processed in 0.124919 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表