PageSourceSearch

https://iwphys.org/assets/javascripts/iwp/iwp6-read.js

js iwphys.org collected 2026-10-04 14:53:03 UTC 1,766 bytes, 62 lines download raw bytes

1/**
2 * Interactive Web Physics 6 - Pure Javascript implementation animation file loading
3 * Ryan Steed, Taylor Brockman 2016 - Version 5.0 Initial Port to HTML + SVG
4 * Matthew Mims, Taylor Brockman 2018  - Version 5.1 Added Graphing and D3
5 * Albert Gong, Nial Mullane, Taylor Brockman 2019 - Version 6.0 Migrated into Play Framework
6 */
7
8
9 /** Simulating version 4 behavior for comparison purposes */
10var MAX_animationSteps = 1000;
11
12
13function readAnimationObject( animation ) {
14    console.log("iwp6-read:10> Entry point for animation: ", animation );
15    if ( typeof animation === "object" ) {
16        var a =  parseAnimationToMemory( animation );
17        masterResetSteps();
18        return a;
19    } else {
20        throw "iwp6-read:16> readAnimationObject 1st Argument must be Javascript Object, was: "+(typeof animation)
21    }
22}
23
24
25function readAnimationString( animationString ) {
26
27    var animation = JSON.parse(animationString);
28
29    console.log("iwp6-read:10> Entry point for animationString: ", animation );
30    if ( typeof animation === "object" ) {
31        var a =  parseAnimationToMemory( animation );
32        masterResetSteps();
33        return a;
34    } else {
35        throw "iwp6-read:31> readAnimationObject 1st Argument must be Javascript Object, was: "+(typeof animation)
36    }
37}
38
39
40function playAnimationToEnd( animationString ) {
41
42    if ( parsedAnimation == null ) {
43        throw "iwp6-read:39> playAnimationToEnd called without an Animation being read yet"
44    }
45
46    masterResetSteps();
47
48    setStepDirection(1);
49
50    var loop = true;
51
52    for ( var i = 0; i < MAX_animationSteps-1 && loop; i++ ) {
53        var loop = handleStep() >= 0;
54        // console.log("iwp6-read:50> Looping after step: " + i );
55    }
56
57    return currentStep;
58}
59
60
61
62true;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.