ZIM BITS TUTORIAL

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>ZIM BITS - Mobile Test</title>

<!-- Welcome to ZIM at https://zimjs.com - Code Creativity!              	        -->
<!-- ZIM runs on the HTML Canvas powered by JavaScript and CreateJS https://createjs.com -->
<!-- Founded by Inventor Dan Zen - http://danzen.com - Canadian New Media Award Winner 	-->
<!-- ZIM is free to use. You can donate to help improve ZIM at http://zimjs.com/donate 	-->

<script src="https://zimjs.org/cdn/1.3.4/createjs.js"></script>
<script src="https://zimjs.org/cdn/01/zim_min.js"></script>
<!-- use zimjs.com/distill for minified individual functions! -->

<script src="https://zimjs.com/bits/footer10.js"></script><!-- you will not need this -->

<script>

// SCALING OPTIONS
// scaling can have values as follows with full being the default
// FIT	sets canvas and stage to dimensions and scales to fit inside window size
// FILL	sets canvas and stage to dimensions and scales to fit outside window size
// FULL	sets stage to window size with no scaling
// "tagID"	add canvas to HTML tag of ID - set to dimensions if provided - no scaling

const scaling = FIT; // this will resize to fit inside the screen dimensions
const width = 1000;
const height = 800;
const color = dark; // or any HTML color such as "violet" or "#333333"
const outerColor = light;

new Frame(scaling, width, height, color, outerColor, ready);
function ready() {

	// given F (Frame), S (Stage), W (width), H (height)

	// ZIM BITS - Mobile Test (2016 - updated 2022)

	// a test to see if app is on desktop or mobile
	// if on mobile, returns android, ios, windows or other
	// otherwise returns false

	// STEPS

	// 1. use the M global which runs ZIM mobile() in the Frame
	// 2. if M is false then write "desktop"
	
	// // The old way with an extra option
	// // 1. assign results of mobile() to a variable
	// // true (default) uses orientation property in test
	// // which might trigger as mobile for some touch screens
	// // setting to false uses regular expressions and may miss some devices
	// let platform = mobile(true);
	// 
	// // 2. test the variable and do what is needed
	// if (!platform) { // if not mobile then desktop
	// 	platform = "desktop";
	// }
	
	const answer = new Label(M?M:"desktop", 140, null, green).center();


	const title = "mobile check: android, ios, windows, other or false for desktop";
	new Label(title, 30, null, "#666")
		.pos(40, 40);

	const docItems = "Frame,Label,pos,center,mobile,zog";
	makeFooter(S, W, H, null, docItems); // ZIM BITS footer - you will not need this

} // end of ready

</script>

<meta name="viewport" content="width=device-width, user-scalable=no" />

</head>

<body>
<!-- canvas with id="myCanvas" is made by zim Frame -->
</body>
</html>