Skip to content

Commit

Permalink
adding stage.setSize(width, height) v-0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Braitsch committed Mar 4, 2013
1 parent 0409e3f commit ec5586a
Show file tree
Hide file tree
Showing 5 changed files with 897 additions and 116 deletions.
13 changes: 7 additions & 6 deletions api/index.php
Expand Up @@ -7,13 +7,13 @@
<p>This page contains a detailed look at the JS3 API</a>
<div class="subnav" style='background-color:#F5F5F5'>
<ul class="nav nav-pills">
<li style='margin-left:50px'><a class='anchor' href="#api-stage">Stage API</a></li>
<li><a class='anchor' href="#api-display-list">The Display List</a></li>
<li style='margin-left:50px'><a class='anchor' href="#api-stage">Stage API</a></li>
<li><a class='anchor' href="#api-display-list">The Display List</a></li>
<li><a class='anchor' href="#api-drawing">Drawing API</a></li>
<li><a class='anchor' href="#api-tweening">The Tween Method</a></li>
<li><a class='anchor' href="#api-timers">Timed Animations</a></li>
<li><a class='anchor' href="#api-framerate">Framerate Monitor</a></li>
<li><a class='anchor' href="#api-utilities">Utility Methods</a></li>
<li><a class='anchor' href="#api-utilities">Utility Methods</a></li>
</ul>
</div>
</div>
Expand All @@ -26,20 +26,21 @@
stage.height :Number; // the height of the Stage
stage.numChildren :Number; // the number of Sprites currently on the display list
stage.mousePressed :Boolean; // whether or not the Mouse is currently pressed down
stage.position :Object; // returns the global {x, y} position of the stage in the html page
stage.position :Object; // returns the global {x, y} position of the stage in the html page
</code></pre>
<p>The following properties of the Stage can be read as well as written, default values are shown.</p>
<pre><code class='javascript'>
stage = new JS3('my-canvas');
stage = new JS3('my-canvas');
stage.interactive = false; // tells the Stage to listen for mouse events
stage.drawClean = true; // tells the Stage to clear itself before drawing the next frame
stage.drawClean = true; // tells the Stage to clear itself before drawing the next frame
stage.background = '#ffffff'; // the background color of the Stage
stage.windowTitle = 'My Canvas'; // the title of pop-up windows used when saving the Stage to a .png
</code></pre>

<p>And the following are general utility methods for controlling the Stage.</p>
<pre><code class='javascript'>
stage = new JS3('my-canvas');
stage.setSize( width:Number, height:Number ); // defaults to the dimensions of your canvas element
stage.save(); // opens a popup window allowing the user to save the current state of the canvas as a .png
stage.clear(); // removes all graphics and children from the Stage
stage.reset(); // calls clear() and also stops all tweens and functions passed to stage.run()
Expand Down
26 changes: 13 additions & 13 deletions local/header.php
@@ -1,5 +1,5 @@
<?php
$version='0.3.1'; $dl='https://raw.github.com/braitsch/js3/master/src/JS3-'.$version.'-min.js';
$version='0.3.2'; $dl='https://raw.github.com/braitsch/js3/master/src/JS3-'.$version.'-min.js';
$root = $_SERVER["REMOTE_ADDR"] == '127.0.0.1' || $_SERVER["REMOTE_ADDR"] == '::1' ? 'http://localhost:8888' : 'http://js3.quietless.com';
function linkto($n){ global $root; echo $root.$n;}
?>
Expand Down Expand Up @@ -28,12 +28,12 @@ function linkto($n){ global $root; echo $root.$n;}
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container" style="width: auto;">
<div class="container" style="width: auto;">
<ul id='global-nav' class="nav pull-left">
<li class="divider-vertical"></li>
<li><a href=<?php linkto('/')?>>JS3</a></li>
<li class="divider-vertical"></li>
<li><a href=<?php linkto('/getting-started')?>>Getting Started</a></li>
<li><a href=<?php linkto('/getting-started')?>>Getting Started</a></li>
<li class="divider-vertical"></li>
<li><a href=<?php linkto('/drawing')?>>Drawing Shapes</a></li>
<li class="divider-vertical"></li>
Expand All @@ -48,32 +48,32 @@ function linkto($n){ global $root; echo $root.$n;}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Gallery<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href=<?php linkto('/gallery/quarks')?>>Quarks</a></li>
<li><a href=<?php linkto('/gallery/quarks')?>>Quarks</a></li>
<li><a href=<?php linkto('/gallery/honeycomb')?>>HoneyComb</a></li>
<li><a href=<?php linkto('/gallery/rings')?>>Rings</a></li>
<li><a href=<?php linkto('/gallery/lite-brite')?>>LiteBrite</a></li>
<li><a href=<?php linkto('/gallery/tube-worms')?>>TubeWorms</a></li>
<li class="divider"></li>
<li><a href=<?php linkto('/gallery/tube-worms')?>>TubeWorms</a></li>
<li class="divider"></li>
<li><a href=<?php linkto('/gallery/joints')?>>Joints</a></li>
<li><a href=<?php linkto('/gallery/spiders')?>>Spiders</a></li>
<li><a href=<?php linkto('/gallery/confetti')?>>Confetti</a></li>
<li><a href=<?php linkto('/gallery/confetti')?>>Confetti</a></li>
<li><a href=<?php linkto('/gallery/snowflakes')?>>SnowFlakes</a></li>
</ul>
</li>
<li class="divider-vertical"></li>
</li>
<li class="divider-vertical"></li>
</ul><!-- download-group -->
<div class="btn-group" style='float:right;right:10px;top:1px;'>
<button class="btn btn-success dropdown-toggle" style='width:161px;' data-toggle="dropdown"><i class="icon-download icon-white"></i>Download <?php echo 'v'.$version;?></button>
<ul class="dropdown-menu">
<li><a href=<?php echo 'https://raw.github.com/braitsch/js3/master/src/JS3-'.$version.'-min.js';?>>Minified</a></li>
<li><a href=<?php echo 'https://raw.github.com/braitsch/js3/master/src/JS3-'.$version.'.js';?>>Uncompressed</a></li>
<li class="divider"></li>
<li><a href=<?php echo $root . '/quick-start.zip'?>>Quick Start</a></li>
<li><a href=<?php echo $root . '/quick-start.zip'?>>Quick Start</a></li>
</ul>
</div><!-- download-group -->
</div><!-- container -->
</div><!-- navbar-inner -->
</div><!-- container -->
</div><!-- navbar-inner -->

</div><!-- navbar -->
<a href="http://github.com/braitsch/js3"><img style="position:absolute;top:41px;right:0;border:0;" src="https://a248.e.akamai.net/camo.github.com/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub"></a>

10 changes: 5 additions & 5 deletions quick-start/index.html
Expand Up @@ -2,16 +2,16 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>JS3 Example Page</title>
<title>JS3 Quick Start</title>
<meta name="author" content="Stephen Braitsch">
</head>
<body>
<!-- Feel free to change the dimensions of the stage but leave the id name intact -->
<!-- Feel free to change the dimensions of the stage but leave the id name intact -->
<canvas id="my-canvas" width="800" height="100"></canvas>

<!-- *** Uncomment one of the following script tags to run that example in your browser *** -->

<!-- <script src="./drawing/simple-shapes.js"></script> -->
<!-- <script src="./drawing/simple-shapes.js"></script> -->
<!-- <script src="./animating/basic-tween.js"></script> -->
<!-- <script src="./animating/basic-runner.js"></script> -->

Expand All @@ -25,6 +25,6 @@
<script src="./gallery/tube-worms.js"></script>

<!-- Path to the JS3 library on GitHub *REQUIRED - DO NOT DELETE* -->
<script src="https://raw.github.com/braitsch/js3/master/src/JS3-0.3.1-min.js"></script>
<script src="https://raw.github.com/braitsch/js3/master/src/JS3.js"></script>
</body>
</html>

0 comments on commit ec5586a

Please sign in to comment.