Easy 3D animation programming in a browser, using VPython, RapydScript, or JavaScript
JavaScript HTML Python GLSL CSS Batchfile
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ForInstalledPython Change initial folder names to MyPrograms (public) and Private Aug 12, 2018
GlowScriptOffline Update offline package Aug 10, 2018
build-tools Fix but in plotly and update uglify Aug 8, 2018
css Display programs on a 2D grid instead of one column; enlarge font siz… Dec 11, 2017
docs Fix helix going to wrong canvas Aug 4, 2018
examples Lots of build-tools files to sync, probably just due to end-of-line m… Apr 8, 2018
ide Change initial folder names to MyPrograms (public) and Private Aug 12, 2018
lib Improve handling of plotly Aug 9, 2018
package Improve handling of plotly Aug 9, 2018
shaders Simplify shaders, knowing that axis and up are now always perpendicul… Jan 31, 2017
static/images Setup initial state of GitHub repository, starting from the bitbucket… Dec 18, 2014
untrusted Fix typo that prevented execution May 27, 2018
.gitignore no need to keep .pyc files in .git May 6, 2017
.project Much improved rate function; documentation improvements/corrections Dec 24, 2014
GlowScriptOffline2.7.zip Update offline package Aug 10, 2018
LICENSE.txt Update contents of License to include information about tessellation … Jul 2, 2016
README.md Update README.md Apr 2, 2018
Stonehenge.html Add dpcs tp offline package Mar 31, 2018
TESTes6.html Add dpcs tp offline package Mar 31, 2018
TESTes6_original.html Add dpcs tp offline package Mar 31, 2018
app.yaml print([ [1,2], [3,4] ]) correctly (recursive);see parsearray in api_m… Sep 20, 2015
bower.json Adds gulp for build support. Prep for bower. May 7, 2015
build_cli.py [build_cli] extract glow libraries from `run.js` Jun 30, 2016
build_only_shaders.py Setup initial state of GitHub repository, starting from the bitbucket… Dec 18, 2014
build_original.py Improve handling of plotly Aug 9, 2018
build_original_no_overload.py Update offline package Aug 10, 2018
gulpfile.js Adding axis label functionality via flot.axislabels plugin Jul 13, 2017
package.json Adds gulp for build support. Prep for bower. May 7, 2015

README.md

GlowScript

GlowScript makes it easy to write programs in JavaScript, RapydScript (a Python look-alike that compiles Python to JavaScript), or VPython (which uses the RapydScript compiler) that generate navigable real-time 3D animations, using the WebGL 3D graphics library available in modern browsers (with modern GPU-based graphics cards). For example, the following complete program creates a 3D canvas in the browser, displays a white 3D cube, creates default lighting, places the camera so that the cube fills the scene, and enables mouse controls to rotate and zoom the camera:

   box()

That's it. That's the whole program (except for the GlowScript version header line that is supplied automatically). The key point is that lots of sensible defaults are built into the GlowScript library. You can of course specify the canvas size, the color and other attributes of the objects, the direction of the camera view, etc.

Documentation

At glowscript.org click Help for full documentation. There is an extensive set of example programs available from the first page of glowscript.org. Programs can be created and stored at glowscript.org, but it is also possible to export a program to place on your own web page, or to use the GlowScript library without storing the program at glowscript.org. For programs stored at glowscript.org, you can share a link with someone and they can run your program simply by clicking on the link. Here is an example:

http://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/Bounce-VPython

GlowScript was inspired by VPython. The project was begun in 2011 by David Scherer and Bruce Sherwood. Originally programs had to be written in JavaScript, but in November 2014 it became possible to use Python, thanks to the RapydScript Python-to-JavaScript compiler created by Alex Tsepkov. GlowScript is now using a later version, RapydScript-ng developed by Kovid Goyal.

For information related to building the GlowScript application, see MakingNewVersion.txt in the docs folder.

Sister Project

A more recent project, VPython 7, was initiated by John Coady and further developed by Ruth Chabay and Bruce Sherwood. VPython 7 lets you run VPython programs in a Jupyter notebook or from program launchers such as IDLE or Spyder: see vpython.org. The syntax is the same as GlowScript VPython, but VPython 7 uses an installed standard Python, which provides access to the large number of Python modules. GlowScript VPython does not require installing any software but provides access only to libraries written in JavaScript, not to standard Python modules.

Run Locally

It is possible to write and run GlowScript programs without an internet connection. Click the GlowScriptOffline zip file listed above and download it. Unzip the contents to a convenient location. In the GlowScriptOffline folder, doubleclick GlowScript.html, which will start up your standard browser with a simple test program. Click Run to run the program. You can drag the vertical gray bar (and/or make the window wider or narrower) to arrange the code and execution regions the way you want them. Make changes to the program and click Run again. If you add a print statement a print area will appear at the right. For security reasons, browsers are not permitted to write to your computer disk. If you want to save the changes you made, copy and paste your code to an application such as Notepad (Windows) or TextEdit (Mac) and save the file. The GlowScript documentation is included in the package and is accessible by clicking Help.

Click Choose File and navigate to the GlowScriptOffline folder to choose from programs in the Demos folder. If you did make changes to the sample program, you'll see a warning that you might wish to save your work before replacing it with the demo program. Similarly, when you close the browser or the browser tab, if you have modified the current program you'll be warned about saving the file.

In the text editor, as in the editor at glowscript.org, select one or more lines and press TAB to indent or Shift-TAB to unindent; press Ctrl-/ to toggle commenting of the lines. When you download programs from glowscript.org, they are in the form of .py files whose first line is "from vpython import *".

This first line is understood by the offline package, as is "GlowScript 2.7 VPython" or "GlowScript 2.7 JavaScript".

Run a Local Server

This repository is a Google App Engine application. Here are instructions for running locally, using a local server (this is much more complicated than running locally as described under the previous heading):

http://www.glowscript.org/docs/GlowScriptDocs/local.html

License

The license is found at LICENSE.txt.

Early version

In December 2014 the original GlowScript repository was corrupted in such a way that it could not be reconstituted, but a backup that contains the history of commits is here:

https://bitbucket.org/davidscherer/glowscript_backup/overview