Create frames to visualize iOS device screen aspect ratios

Let us know if you have a nice R.U.B.E script to share!
Post Reply
iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Create frames to visualize iOS device screen aspect ratios

Post by iforce2d » Tue Apr 09, 2013 7:40 am

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]}}');

qq200600
Posts: 29
Joined: Fri Dec 28, 2012 9:27 am

Re: Create frames to visualize iOS device screen aspect rati

Post by qq200600 » Wed Dec 02, 2015 5:03 pm

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]}}');

Post Reply