Page 1 of 1

Create frames to visualize iOS device screen aspect ratios

Posted: Tue Apr 09, 2013 7:40 am
by iforce2d
This script creates a static body with some loop fixtures as frames to help visualize various mobile device screen proportions.

Code: Select all

body b = addBody(-1, '{}');
// 3:2
b.addFixture(-1, '{"name":"Aspect 3:2 (iPhone)","sensor":true,"shapes":[{"type":"loop"}],"vertices":{"x":[-4.8,4.8,4.8,-4.8],"y":[0,0,6.4,6.4]}}');
// 16:9
b.addFixture(-1, '{"name":"Aspect 16:9 (iPhone5)","sensor":true,"shapes":[{"type":"loop"}],"vertices":{"x":[-5.68,5.68,5.68,-5.68],"y":[0,0,6.4,6.4]}}');
// 4:3
b.addFixture(-1, '{"name":"Aspect 4:3 (iPad)","sensor":true,"shapes":[{"type":"loop"}],"vertices":{"x":[-4.266,4.266,4.266,-4.266],"y":[0,0,6.4,6.4]}}');

Re: Create frames to visualize iOS device screen aspect rati

Posted: Wed Dec 02, 2015 5:03 pm
by qq200600
Thanks!

Code: Select all

body b = addBody(-1, '{}');
//android
// 3:2
b.addFixture(-1, '{"name":"Aspect 3:2 (Amdroid)","sensor":true,"shapes":[{"type":"loop"}],"vertices":{"x":[0,25,25,0],"y":[0,0,15,15]}}');