v0.2.2 9100209

adw-spring-animation.go RawHistoryFolder

1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13	"github.com/bnema/puregotk/v4/gtk"
14)
15
16type SpringAnimationClass struct {
17	_ structs.HostLayout
18}
19
20func (x *SpringAnimationClass) GoPointer() uintptr {
21	return uintptr(unsafe.Pointer(x))
22}
23
24// A spring-based [class@Animation].
25//
26// `AdwSpringAnimation` implements an animation driven by a physical model of a
27// spring described by [struct@SpringParams], with a resting position in
28// [property@SpringAnimation:value-to], stretched to
29// [property@SpringAnimation:value-from].
30//
31// Since the animation is physically simulated, spring animations don't have a
32// fixed duration. The animation will stop when the simulated spring comes to a
33// rest - when the amplitude of the oscillations becomes smaller than
34// [property@SpringAnimation:epsilon], or immediately when it reaches
35// [property@SpringAnimation:value-to] if
36// [property@SpringAnimation:clamp] is set to `TRUE`. The estimated duration can
37// be obtained with [property@SpringAnimation:estimated-duration].
38//
39// Due to the nature of spring-driven motion the animation can overshoot
40// [property@SpringAnimation:value-to] before coming to a rest. Whether the
41// animation will overshoot or not depends on the damping ratio of the spring.
42// See [struct@SpringParams] for more information about specific damping ratio
43// values.
44//
45// If [property@SpringAnimation:clamp] is `TRUE`, the animation will abruptly
46// end as soon as it reaches the final value, preventing overshooting.
47//
48// Animations can have an initial velocity value, set via
49// [property@SpringAnimation:initial-velocity], which adjusts the curve without
50// changing the duration. This makes spring animations useful for deceleration
51// at the end of gestures.
52//
53// If the initial and final values are equal, and the initial velocity is not 0,
54// the animation value will bounce and return to its resting position.
55type SpringAnimation struct {
56	Animation
57}
58
59var xSpringAnimationGLibType func() types.GType
60
61func SpringAnimationGLibType() types.GType {
62	return xSpringAnimationGLibType()
63}
64
65func SpringAnimationNewFromInternalPtr(ptr uintptr) *SpringAnimation {
66	cls := &SpringAnimation{}
67	cls.Ptr = ptr
68	return cls
69}
70
71var xNewSpringAnimation func(uintptr, float64, float64, *SpringParams, uintptr) uintptr
72
73// Creates a new `AdwSpringAnimation` on @widget.
74//
75// The animation will animate @target from @from to @to with the dynamics of a
76// spring described by @spring_params.
77func NewSpringAnimation(WidgetVar *gtk.Widget, FromVar float64, ToVar float64, SpringParamsVar *SpringParams, TargetVar *AnimationTarget) *SpringAnimation {
78	var cls *SpringAnimation
79
80	cret := xNewSpringAnimation(WidgetVar.GoPointer(), FromVar, ToVar, SpringParamsVar, TargetVar.GoPointer())
81
82	if cret == 0 {
83		return nil
84	}
85	gobject.IncreaseRef(cret)
86	cls = &SpringAnimation{}
87	cls.Ptr = cret
88	return cls
89}
90
91var xSpringAnimationCalculateValue func(uintptr, uint) float64
92
93// Calculates the value @self will have at @time.
94//
95// The time starts at 0 and ends at
96// [property@SpringAnimation:estimated_duration].
97//
98// See also [method@SpringAnimation.calculate_velocity].
99func (x *SpringAnimation) CalculateValue(TimeVar uint) float64 {
100
101	cret := xSpringAnimationCalculateValue(x.GoPointer(), TimeVar)
102	return cret
103}
104
105var xSpringAnimationCalculateVelocity func(uintptr, uint) float64
106
107// Calculates the velocity @self will have at @time.
108//
109// The time starts at 0 and ends at
110// [property@SpringAnimation:estimated_duration].
111//
112// See also [method@SpringAnimation.calculate_value].
113func (x *SpringAnimation) CalculateVelocity(TimeVar uint) float64 {
114
115	cret := xSpringAnimationCalculateVelocity(x.GoPointer(), TimeVar)
116	return cret
117}
118
119var xSpringAnimationGetClamp func(uintptr) bool
120
121// Gets whether @self should be clamped.
122func (x *SpringAnimation) GetClamp() bool {
123
124	cret := xSpringAnimationGetClamp(x.GoPointer())
125	return cret
126}
127
128var xSpringAnimationGetEpsilon func(uintptr) float64
129
130// Gets the precision of the spring.
131func (x *SpringAnimation) GetEpsilon() float64 {
132
133	cret := xSpringAnimationGetEpsilon(x.GoPointer())
134	return cret
135}
136
137var xSpringAnimationGetEstimatedDuration func(uintptr) uint
138
139// Gets the estimated duration of @self, in milliseconds.
140//
141// Can be [const@DURATION_INFINITE] if the spring damping is set to 0.
142func (x *SpringAnimation) GetEstimatedDuration() uint {
143
144	cret := xSpringAnimationGetEstimatedDuration(x.GoPointer())
145	return cret
146}
147
148var xSpringAnimationGetInitialVelocity func(uintptr) float64
149
150// Gets the initial velocity of @self.
151func (x *SpringAnimation) GetInitialVelocity() float64 {
152
153	cret := xSpringAnimationGetInitialVelocity(x.GoPointer())
154	return cret
155}
156
157var xSpringAnimationGetSpringParams func(uintptr) *SpringParams
158
159// Gets the physical parameters of the spring of @self.
160func (x *SpringAnimation) GetSpringParams() *SpringParams {
161
162	cret := xSpringAnimationGetSpringParams(x.GoPointer())
163	return cret
164}
165
166var xSpringAnimationGetValueFrom func(uintptr) float64
167
168// Gets the value @self will animate from.
169func (x *SpringAnimation) GetValueFrom() float64 {
170
171	cret := xSpringAnimationGetValueFrom(x.GoPointer())
172	return cret
173}
174
175var xSpringAnimationGetValueTo func(uintptr) float64
176
177// Gets the value @self will animate to.
178func (x *SpringAnimation) GetValueTo() float64 {
179
180	cret := xSpringAnimationGetValueTo(x.GoPointer())
181	return cret
182}
183
184var xSpringAnimationGetVelocity func(uintptr) float64
185
186// Gets the current velocity of @self.
187func (x *SpringAnimation) GetVelocity() float64 {
188
189	cret := xSpringAnimationGetVelocity(x.GoPointer())
190	return cret
191}
192
193var xSpringAnimationSetClamp func(uintptr, bool)
194
195// Sets whether @self should be clamped.
196//
197// If set to `TRUE`, the animation will abruptly end as soon as it reaches the
198// final value, preventing overshooting.
199//
200// It won't prevent overshooting [property@SpringAnimation:value-from] if a
201// relative negative [property@SpringAnimation:initial-velocity] is set.
202func (x *SpringAnimation) SetClamp(ClampVar bool) {
203
204	xSpringAnimationSetClamp(x.GoPointer(), ClampVar)
205
206}
207
208var xSpringAnimationSetEpsilon func(uintptr, float64)
209
210// Sets the precision of the spring.
211//
212// The level of precision used to determine when the animation has come to a
213// rest, that is, when the amplitude of the oscillations becomes smaller than
214// this value.
215//
216// If the epsilon value is too small, the animation will take a long time to
217// stop after the animated value has stopped visibly changing.
218//
219// If the epsilon value is too large, the animation will end prematurely.
220//
221// The default value is 0.001.
222func (x *SpringAnimation) SetEpsilon(EpsilonVar float64) {
223
224	xSpringAnimationSetEpsilon(x.GoPointer(), EpsilonVar)
225
226}
227
228var xSpringAnimationSetInitialVelocity func(uintptr, float64)
229
230// Sets the initial velocity of @self.
231//
232// Initial velocity affects only the animation curve, but not its duration.
233func (x *SpringAnimation) SetInitialVelocity(VelocityVar float64) {
234
235	xSpringAnimationSetInitialVelocity(x.GoPointer(), VelocityVar)
236
237}
238
239var xSpringAnimationSetSpringParams func(uintptr, *SpringParams)
240
241// Sets the physical parameters of the spring of @self.
242func (x *SpringAnimation) SetSpringParams(SpringParamsVar *SpringParams) {
243
244	xSpringAnimationSetSpringParams(x.GoPointer(), SpringParamsVar)
245
246}
247
248var xSpringAnimationSetValueFrom func(uintptr, float64)
249
250// Sets the value @self will animate from.
251//
252// The animation will start at this value and end at
253// [property@SpringAnimation:value-to].
254func (x *SpringAnimation) SetValueFrom(ValueVar float64) {
255
256	xSpringAnimationSetValueFrom(x.GoPointer(), ValueVar)
257
258}
259
260var xSpringAnimationSetValueTo func(uintptr, float64)
261
262// Sets the value @self will animate to.
263//
264// The animation will start at [property@SpringAnimation:value-from] and end at
265// this value.
266func (x *SpringAnimation) SetValueTo(ValueVar float64) {
267
268	xSpringAnimationSetValueTo(x.GoPointer(), ValueVar)
269
270}
271
272func (c *SpringAnimation) GoPointer() uintptr {
273	if c == nil {
274		return 0
275	}
276	return c.Ptr
277}
278
279func (c *SpringAnimation) SetGoPointer(ptr uintptr) {
280	c.Ptr = ptr
281}
282
283// SetPropertyClamp sets the "clamp" property.
284// Whether the animation should be clamped.
285//
286// If set to `TRUE`, the animation will abruptly end as soon as it reaches the
287// final value, preventing overshooting.
288//
289// It won't prevent overshooting [property@SpringAnimation:value-from] if a
290// relative negative [property@SpringAnimation:initial-velocity] is set.
291func (x *SpringAnimation) SetPropertyClamp(value bool) {
292	var v gobject.Value
293	v.Init(gobject.TypeBooleanVal)
294	v.SetBoolean(value)
295	x.SetProperty("clamp", &v)
296}
297
298// GetPropertyClamp gets the "clamp" property.
299// Whether the animation should be clamped.
300//
301// If set to `TRUE`, the animation will abruptly end as soon as it reaches the
302// final value, preventing overshooting.
303//
304// It won't prevent overshooting [property@SpringAnimation:value-from] if a
305// relative negative [property@SpringAnimation:initial-velocity] is set.
306func (x *SpringAnimation) GetPropertyClamp() bool {
307	var v gobject.Value
308	x.GetProperty("clamp", &v)
309	return v.GetBoolean()
310}
311
312// SetPropertyEpsilon sets the "epsilon" property.
313// Precision of the spring.
314//
315// The level of precision used to determine when the animation has come to a
316// rest, that is, when the amplitude of the oscillations becomes smaller than
317// this value.
318//
319// If the epsilon value is too small, the animation will take a long time to
320// stop after the animated value has stopped visibly changing.
321//
322// If the epsilon value is too large, the animation will end prematurely.
323//
324// The default value is 0.001.
325func (x *SpringAnimation) SetPropertyEpsilon(value float64) {
326	var v gobject.Value
327	v.Init(gobject.TypeDoubleVal)
328	v.SetDouble(value)
329	x.SetProperty("epsilon", &v)
330}
331
332// GetPropertyEpsilon gets the "epsilon" property.
333// Precision of the spring.
334//
335// The level of precision used to determine when the animation has come to a
336// rest, that is, when the amplitude of the oscillations becomes smaller than
337// this value.
338//
339// If the epsilon value is too small, the animation will take a long time to
340// stop after the animated value has stopped visibly changing.
341//
342// If the epsilon value is too large, the animation will end prematurely.
343//
344// The default value is 0.001.
345func (x *SpringAnimation) GetPropertyEpsilon() float64 {
346	var v gobject.Value
347	x.GetProperty("epsilon", &v)
348	return v.GetDouble()
349}
350
351// GetPropertyEstimatedDuration gets the "estimated-duration" property.
352// Estimated duration of the animation, in milliseconds.
353//
354// Can be [const@DURATION_INFINITE] if the spring damping is set to 0.
355func (x *SpringAnimation) GetPropertyEstimatedDuration() uint {
356	var v gobject.Value
357	x.GetProperty("estimated-duration", &v)
358	return v.GetUint()
359}
360
361// SetPropertyInitialVelocity sets the "initial-velocity" property.
362// The initial velocity to start the animation with.
363//
364// Initial velocity affects only the animation curve, but not its duration.
365func (x *SpringAnimation) SetPropertyInitialVelocity(value float64) {
366	var v gobject.Value
367	v.Init(gobject.TypeDoubleVal)
368	v.SetDouble(value)
369	x.SetProperty("initial-velocity", &v)
370}
371
372// GetPropertyInitialVelocity gets the "initial-velocity" property.
373// The initial velocity to start the animation with.
374//
375// Initial velocity affects only the animation curve, but not its duration.
376func (x *SpringAnimation) GetPropertyInitialVelocity() float64 {
377	var v gobject.Value
378	x.GetProperty("initial-velocity", &v)
379	return v.GetDouble()
380}
381
382// SetPropertySpringParams sets the "spring-params" property.
383// Physical parameters describing the spring.
384func (x *SpringAnimation) SetPropertySpringParams(value uintptr) {
385	var v gobject.Value
386	v.Init(gobject.TypePointerVal)
387	v.SetPointer(value)
388	x.SetProperty("spring-params", &v)
389}
390
391// GetPropertySpringParams gets the "spring-params" property.
392// Physical parameters describing the spring.
393func (x *SpringAnimation) GetPropertySpringParams() uintptr {
394	var v gobject.Value
395	x.GetProperty("spring-params", &v)
396	return v.GetPointer()
397}
398
399// SetPropertyValueFrom sets the "value-from" property.
400// The value to animate from.
401//
402// The animation will start at this value and end at
403// [property@SpringAnimation:value-to].
404func (x *SpringAnimation) SetPropertyValueFrom(value float64) {
405	var v gobject.Value
406	v.Init(gobject.TypeDoubleVal)
407	v.SetDouble(value)
408	x.SetProperty("value-from", &v)
409}
410
411// GetPropertyValueFrom gets the "value-from" property.
412// The value to animate from.
413//
414// The animation will start at this value and end at
415// [property@SpringAnimation:value-to].
416func (x *SpringAnimation) GetPropertyValueFrom() float64 {
417	var v gobject.Value
418	x.GetProperty("value-from", &v)
419	return v.GetDouble()
420}
421
422// SetPropertyValueTo sets the "value-to" property.
423// The value to animate to.
424//
425// The animation will start at [property@SpringAnimation:value-from] and end
426// at this value.
427func (x *SpringAnimation) SetPropertyValueTo(value float64) {
428	var v gobject.Value
429	v.Init(gobject.TypeDoubleVal)
430	v.SetDouble(value)
431	x.SetProperty("value-to", &v)
432}
433
434// GetPropertyValueTo gets the "value-to" property.
435// The value to animate to.
436//
437// The animation will start at [property@SpringAnimation:value-from] and end
438// at this value.
439func (x *SpringAnimation) GetPropertyValueTo() float64 {
440	var v gobject.Value
441	x.GetProperty("value-to", &v)
442	return v.GetDouble()
443}
444
445// GetPropertyVelocity gets the "velocity" property.
446// Current velocity of the animation.
447func (x *SpringAnimation) GetPropertyVelocity() float64 {
448	var v gobject.Value
449	x.GetProperty("velocity", &v)
450	return v.GetDouble()
451}
452
453func init() {
454	core.SetPackageName("ADW", "libadwaita-1")
455	core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
456	var libs []uintptr
457	for _, libPath := range core.GetPaths("ADW") {
458		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
459		if err != nil {
460			panic(err)
461		}
462		libs = append(libs, lib)
463	}
464
465	core.PuregoSafeRegister(&xSpringAnimationGLibType, libs, "adw_spring_animation_get_type")
466
467	core.PuregoSafeRegister(&xNewSpringAnimation, libs, "adw_spring_animation_new")
468
469	core.PuregoSafeRegister(&xSpringAnimationCalculateValue, libs, "adw_spring_animation_calculate_value")
470	core.PuregoSafeRegister(&xSpringAnimationCalculateVelocity, libs, "adw_spring_animation_calculate_velocity")
471	core.PuregoSafeRegister(&xSpringAnimationGetClamp, libs, "adw_spring_animation_get_clamp")
472	core.PuregoSafeRegister(&xSpringAnimationGetEpsilon, libs, "adw_spring_animation_get_epsilon")
473	core.PuregoSafeRegister(&xSpringAnimationGetEstimatedDuration, libs, "adw_spring_animation_get_estimated_duration")
474	core.PuregoSafeRegister(&xSpringAnimationGetInitialVelocity, libs, "adw_spring_animation_get_initial_velocity")
475	core.PuregoSafeRegister(&xSpringAnimationGetSpringParams, libs, "adw_spring_animation_get_spring_params")
476	core.PuregoSafeRegister(&xSpringAnimationGetValueFrom, libs, "adw_spring_animation_get_value_from")
477	core.PuregoSafeRegister(&xSpringAnimationGetValueTo, libs, "adw_spring_animation_get_value_to")
478	core.PuregoSafeRegister(&xSpringAnimationGetVelocity, libs, "adw_spring_animation_get_velocity")
479	core.PuregoSafeRegister(&xSpringAnimationSetClamp, libs, "adw_spring_animation_set_clamp")
480	core.PuregoSafeRegister(&xSpringAnimationSetEpsilon, libs, "adw_spring_animation_set_epsilon")
481	core.PuregoSafeRegister(&xSpringAnimationSetInitialVelocity, libs, "adw_spring_animation_set_initial_velocity")
482	core.PuregoSafeRegister(&xSpringAnimationSetSpringParams, libs, "adw_spring_animation_set_spring_params")
483	core.PuregoSafeRegister(&xSpringAnimationSetValueFrom, libs, "adw_spring_animation_set_value_from")
484	core.PuregoSafeRegister(&xSpringAnimationSetValueTo, libs, "adw_spring_animation_set_value_to")
485
486}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close