-
Notifications
You must be signed in to change notification settings - Fork 6
/
adw-spring-params.go
217 lines (172 loc) · 5.56 KB
/
adw-spring-params.go
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
// Code generated by girgen. DO NOT EDIT.
package adw
import (
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"
// GType values.
var (
GTypeSpringParams = coreglib.Type(C.adw_spring_params_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeSpringParams, F: marshalSpringParams},
})
}
// SpringParams: physical parameters of a spring for springanimation.
//
// Any spring can be described by three parameters: mass, stiffness and damping.
//
// An undamped spring will produce an oscillatory motion which will go on
// forever.
//
// The frequency and amplitude of the oscillations will be determined by the
// stiffness (how "strong" the spring is) and its mass (how much "inertia" it
// has).
//
// If damping is larger than 0, the amplitude of that oscillating motion will
// exponientally decrease over time. If that damping is strong enough that the
// spring can't complete a full oscillation, it's called an overdamped spring.
//
// If we the spring can oscillate, it's called an underdamped spring.
//
// The value between these two behaviors is called critical damping;
// a critically damped spring will comes to rest in the minimum possible time
// without producing oscillations.
//
// The damping can be replaced by damping ratio, which produces the following
// springs:
//
// * 0: an undamped spring. * Between 0 and 1: an underdamped spring. * 1:
// a critically damped spring. * Larger than 1: an overdamped spring.
//
// # As such
//
// An instance of this type is always passed by reference.
type SpringParams struct {
*springParams
}
// springParams is the struct that's finalized.
type springParams struct {
native *C.AdwSpringParams
}
func marshalSpringParams(p uintptr) (interface{}, error) {
b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed()
return &SpringParams{&springParams{(*C.AdwSpringParams)(b)}}, nil
}
// NewSpringParams constructs a struct SpringParams.
func NewSpringParams(dampingRatio float64, mass float64, stiffness float64) *SpringParams {
var _arg1 C.double // out
var _arg2 C.double // out
var _arg3 C.double // out
var _cret *C.AdwSpringParams // in
_arg1 = C.double(dampingRatio)
_arg2 = C.double(mass)
_arg3 = C.double(stiffness)
_cret = C.adw_spring_params_new(_arg1, _arg2, _arg3)
runtime.KeepAlive(dampingRatio)
runtime.KeepAlive(mass)
runtime.KeepAlive(stiffness)
var _springParams *SpringParams // out
_springParams = (*SpringParams)(gextras.NewStructNative(unsafe.Pointer(_cret)))
runtime.SetFinalizer(
gextras.StructIntern(unsafe.Pointer(_springParams)),
func(intern *struct{ C unsafe.Pointer }) {
C.adw_spring_params_unref((*C.AdwSpringParams)(intern.C))
},
)
return _springParams
}
// NewSpringParamsFull constructs a struct SpringParams.
func NewSpringParamsFull(damping float64, mass float64, stiffness float64) *SpringParams {
var _arg1 C.double // out
var _arg2 C.double // out
var _arg3 C.double // out
var _cret *C.AdwSpringParams // in
_arg1 = C.double(damping)
_arg2 = C.double(mass)
_arg3 = C.double(stiffness)
_cret = C.adw_spring_params_new_full(_arg1, _arg2, _arg3)
runtime.KeepAlive(damping)
runtime.KeepAlive(mass)
runtime.KeepAlive(stiffness)
var _springParams *SpringParams // out
_springParams = (*SpringParams)(gextras.NewStructNative(unsafe.Pointer(_cret)))
runtime.SetFinalizer(
gextras.StructIntern(unsafe.Pointer(_springParams)),
func(intern *struct{ C unsafe.Pointer }) {
C.adw_spring_params_unref((*C.AdwSpringParams)(intern.C))
},
)
return _springParams
}
// Damping gets the damping of self.
//
// The function returns the following values:
//
// - gdouble: damping.
//
func (self *SpringParams) Damping() float64 {
var _arg0 *C.AdwSpringParams // out
var _cret C.double // in
_arg0 = (*C.AdwSpringParams)(gextras.StructNative(unsafe.Pointer(self)))
_cret = C.adw_spring_params_get_damping(_arg0)
runtime.KeepAlive(self)
var _gdouble float64 // out
_gdouble = float64(_cret)
return _gdouble
}
// DampingRatio gets the damping ratio of self.
//
// The function returns the following values:
//
// - gdouble: damping ratio.
//
func (self *SpringParams) DampingRatio() float64 {
var _arg0 *C.AdwSpringParams // out
var _cret C.double // in
_arg0 = (*C.AdwSpringParams)(gextras.StructNative(unsafe.Pointer(self)))
_cret = C.adw_spring_params_get_damping_ratio(_arg0)
runtime.KeepAlive(self)
var _gdouble float64 // out
_gdouble = float64(_cret)
return _gdouble
}
// Mass gets the mass of self.
//
// The function returns the following values:
//
// - gdouble: mass.
//
func (self *SpringParams) Mass() float64 {
var _arg0 *C.AdwSpringParams // out
var _cret C.double // in
_arg0 = (*C.AdwSpringParams)(gextras.StructNative(unsafe.Pointer(self)))
_cret = C.adw_spring_params_get_mass(_arg0)
runtime.KeepAlive(self)
var _gdouble float64 // out
_gdouble = float64(_cret)
return _gdouble
}
// Stiffness gets the stiffness of self.
//
// The function returns the following values:
//
// - gdouble: stiffness.
//
func (self *SpringParams) Stiffness() float64 {
var _arg0 *C.AdwSpringParams // out
var _cret C.double // in
_arg0 = (*C.AdwSpringParams)(gextras.StructNative(unsafe.Pointer(self)))
_cret = C.adw_spring_params_get_stiffness(_arg0)
runtime.KeepAlive(self)
var _gdouble float64 // out
_gdouble = float64(_cret)
return _gdouble
}