aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/flow-path-sigmoid.js
blob: 2e776b5a211243216a81a1d0b8b27f4e506b90aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
var Montage = require("montage").Montage;

var FlowPathSigmoid = exports.FlowPathSigmoid = Montage.create(Montage, {

    _variable: {
        enumerable: false,
        value: "time"
    },

    variable: {
        get: function () {
            return this._variable;
        },
        set: function (value) {
            switch (value) {
                case "speed":
                case "index":
                    this._variable = value;
                    break;
                default:
                    this._variable = "time";
            }
            this._updatePath();
        }
    },

    _smoothness: {
        enumerable: false,
        value: 0
    },

    smoothness: {
        get: function () {
            return this._smoothness;
        },
        set: function (value) {
            this._smoothness = value;
            this._updatePath();
        }
    },

    _scale: {
        enumerable: false,
        value: 0
    },

    scale: {
        get: function () {
            return this._scale;
        },
        set: function (value) {
            this._scale = value;
            this._updatePath();
        }
    },

    _width: {
        enumerable: false,
        value: 0
    },

    width: {
        get: function () {
            return this._width;
        },
        set: function (value) {
            this._width = value;
            this._updatePath();
        }
    },

    _origin: {
        enumerable: false,
        value: 0
    },

    origin: {
        get: function () {
            return this._origin;
        },
        set: function (value) {
            this._origin = value;
            this._updatePath();
        }
    },

    _sigmoidCenter: {
        enumerable: false,
        value: 0
    },

    sigmoidCenter: {
        get: function () {
            return this._sigmoidCenter;
        },
        set: function (value) {
            this._sigmoidCenter = value;
            this._updatePath();
        }
    },

    _slope: {
        enumerable: false,
        value: 1
    },

    slope: {
        get: function () {
            return this._slope;
        },
        set: function (value) {
            this._slope = value;
            this._updatePath();
        }
    },

    _path: {
        enumerable: false,
        value: "0"
    },

    path: {
        get: function () {
            return this._path;
        },
        set: function (value) {
            this._path = value;
        }
    },

    _updatePath: {
        enumerable: false,
        value: function () {
            var s = "(slide."+this._variable+"-("+this._origin+"))";


/**            parseInt((a/(1+Math.pow(c, -(j*d)))-(a/2)+j*b)*1000)/1000;
            this.path = "parseInt(("+this._a+"/(1+Math.pow("+this._c+", -"+s+"*("+this._d+")))-(("+this._a+")/2)+"+s+"*("+this._b+"))*1000)/1000";*/
            this.path = "((("+this._width+")/(1+Math.pow(2, (("+this._sigmoidCenter+")-"+s+")/("+this._smoothness+"))))-("+(this._width/2)+")+"+s+"*("+this._slope+"))*("+this._scale+")";
        }
    }
});