GlowScript: Difference between revisions

From Physics Book
Jump to navigation Jump to search
mNo edit summary
Line 7: Line 7:


Once signed in, select the bolded word '''here''' to open your programs.<br>
Once signed in, select the bolded word '''here''' to open your programs.<br>
New folders and programs can be set as either private or public.<br>
Select '''Create New Program''' to create a new program in the desired folder. Names for programs cannot include spaces or underscores.


'''Example Programs''' provides examples of all the capabilities of the GlowScript website.
'''Example Programs''' provides examples of all the capabilities of the GlowScript website.
Line 14: Line 12:
'''Forum''' opens a Google Group page where anyone can ask questions or voice concerns regarding the use of GlowScript.
'''Forum''' opens a Google Group page where anyone can ask questions or voice concerns regarding the use of GlowScript.


'''Help''' in the upper right offers basic instructiosn on how to use the website including how to get started and how to use the text editor.
'''Help''' in the upper right offers basic instructions on how to use the website including how to get started and how to use the text editor.


== Writing a Program ==
== Writing a Program ==

Revision as of 19:22, 15 November 2020

Claimed by Autumn Toms Fall 2020

GlowScript is an intuitive website used to create 3D animations and share them on the web. Programs can be written right in your browser, stored on the cloud for free, and easily shared with a link.
GlowScript supports both VPython, JavaScript, and CoffeeScript, however for the purposes of this course, scripts are written in VPython.

glowscript.org

Once signed in, select the bolded word here to open your programs.

Example Programs provides examples of all the capabilities of the GlowScript website.

Forum opens a Google Group page where anyone can ask questions or voice concerns regarding the use of GlowScript.

Help in the upper right offers basic instructions on how to use the website including how to get started and how to use the text editor.

Writing a Program

Header


GlowScript 3.0 VPython is required in header to run Vpython.


Initialize new Variables


Use var and assign values.

var x, y
x = 2
y = 3


3D Objects


Arrow

newArrow = arrow(pos=vec(x0, y0, z0), shaftwidth=1, axis_and_length=vec(x1, y1, z1))

This creates arrow that starts at point <x0, y0, z0> that points <x1, y1, z1>

Box

newBox = box(pos=vec(x0, y0, z0), size=vec(L, H, W))

This creates a box with a center <x0, y0, z0> and with size <L, H, W>

Sphere

newSphere = sphere(pos=vec(x0, y0, z0), size=vec(x1, y1, z1) )

This creates a box with a center <x0, y0, z0> and with size <x1, y1, z1>

You can learn more by clicking this. [1]

Customizing Objects


Color
There are 10 default colors that can be used.

color.red, color.yellow, color.green, color.orange
color.blue, color.cyan, color.magenta, color.purple
color.black, color.white

Colors can be customized by user by using following code.

vec(1, 0.5, 0.3)

In this case, R is 1, G = 0.7, and B = 0.2, which has color of pastel orange.

Animation Speed

rate(50)

This line will halt each computations to have interval of 1.0/50.0 second.

Supported Environments

Browsers: Chrome, Firefox, Safari, Internet Explorer, and Edge. Chrome and Edge are recommended.
Devices: Most smart devices running Android or iOS.