glimmer-dsl-swt 4.20.7.0 → 4.20.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +5 -5
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +12 -9
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/dsl/swt/multiply_expression.rb +4 -1
- data/lib/glimmer/swt/custom/animation.rb +21 -7
- data/lib/glimmer/swt/custom/shape/line.rb +6 -6
- data/lib/glimmer/swt/transform_proxy.rb +13 -1
- data/samples/hello/hello_canvas_animation.rb +50 -10
- data/samples/hello/hello_canvas_transform.rb +8 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9e4926af5ca63c55c0c1dc038339964678641b28dfe0b868ef0907674b151dd
|
4
|
+
data.tar.gz: 5789d0ea80816b981f912deeadbcdd5d587a84d7669671f951983b225785a533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c96b75dc0513e911bb0d925ecfaf76f979d9f65adf2efafaac161b622975b196c450df1300574c65913fce9ee077b96072845a578f7244c920b7a04e9c955651
|
7
|
+
data.tar.gz: 2956cc963363b9e428a3e07877e0fc7bc40c1e67ab38e5915da86ebc44f87fe2d360cd763ec2fe50565ba67891414ec0d241223740bcc9cd17f36907e45b60dd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.20.10.0
|
4
|
+
|
5
|
+
- Support noun alternatives for `Canvas Transform DSL` operations:
|
6
|
+
- `multiply(&block)` => `multiplication(&block)`
|
7
|
+
- `invert` => `inversion`
|
8
|
+
- `rotate(angle)` => `rotation(angle)`
|
9
|
+
- `translate(x, y)` => `translation(x, y)`
|
10
|
+
|
11
|
+
### 4.20.9.1
|
12
|
+
|
13
|
+
- Fix issue with not being able to use :default x/y location with composite/custom shapes containing lines
|
14
|
+
|
15
|
+
### 4.20.9.0
|
16
|
+
|
17
|
+
- Canvas animation fps/frame_rate property to set frames-per-second rate of rendering (alternative to every)
|
18
|
+
|
19
|
+
### 4.20.8.0
|
20
|
+
|
21
|
+
- Support data-binding Animation `duration_limit` property
|
22
|
+
- Improve support of Animation `duration_limit` property in recognizing when an animation is finished
|
23
|
+
- Added duration limit to Hello, Canvas Animation! sample
|
24
|
+
|
3
25
|
### 4.20.7.0
|
4
26
|
|
5
27
|
- Add Canvas Animation DSL #finished, #finished?, #finished= properties
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.20.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.20.10.0
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -15,7 +15,7 @@
|
|
15
15
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
16
16
|
Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
|
17
17
|
|
18
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.10.0 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
|
19
19
|
|
20
20
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
|
21
21
|
|
@@ -347,7 +347,7 @@ jgem install glimmer-dsl-swt
|
|
347
347
|
|
348
348
|
Or this command if you want a specific version:
|
349
349
|
```
|
350
|
-
jgem install glimmer-dsl-swt -v 4.20.
|
350
|
+
jgem install glimmer-dsl-swt -v 4.20.10.0
|
351
351
|
```
|
352
352
|
|
353
353
|
`jgem` is JRuby's version of `gem` command.
|
@@ -375,7 +375,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
375
375
|
|
376
376
|
Add the following to `Gemfile`:
|
377
377
|
```
|
378
|
-
gem 'glimmer-dsl-swt', '~> 4.20.
|
378
|
+
gem 'glimmer-dsl-swt', '~> 4.20.10.0'
|
379
379
|
```
|
380
380
|
|
381
381
|
And, then run:
|
@@ -396,7 +396,7 @@ glimmer
|
|
396
396
|
```
|
397
397
|
|
398
398
|
```
|
399
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.
|
399
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.10.0
|
400
400
|
|
401
401
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
402
402
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.20.
|
1
|
+
4.20.10.0
|
@@ -2165,12 +2165,12 @@ The first 2 values represent the 1st row, the second 2 values represent the 2nd
|
|
2165
2165
|
|
2166
2166
|
Additionally, Transform operation keywords may be nested within the `transform` keyword to set its properties:
|
2167
2167
|
- `identity` resets transform to identity (no transformation)
|
2168
|
-
- `invert` inverts a transform
|
2169
|
-
- `multiply(&
|
2170
|
-
- `rotate(angle)` rotates by angle degrees
|
2168
|
+
- `invert` (alias: `inversion`) inverts a transform
|
2169
|
+
- `multiply(&transform_properties_block)` (alias: `multiplication`) multiplies by another transform (takes a block representing properties of another transform, no need for using the word transform again)
|
2170
|
+
- `rotate(angle)` (alias: `rotation`) rotates by angle degrees
|
2171
2171
|
- `scale(x, y)` scales a shape (stretch)
|
2172
2172
|
- `shear(x, y)` shear effect
|
2173
|
-
- `translate(x, y)` translate x and y coordinates (move)
|
2173
|
+
- `translate(x, y)` (alias: `translation`) translate x and y coordinates (move)
|
2174
2174
|
- `elements(m11, m12, m21, m22, dx, dy)` resets all values of the transform matrix (first 2 values represent the 1st row, second 2 values represent the 2nd row, the last 2 values represent translation on x and y axes)
|
2175
2175
|
|
2176
2176
|
Also, setting `transform` to `nil` after a previous `transform` has been set is like calling `identity`. It resets the transform.
|
@@ -2239,7 +2239,7 @@ Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-can
|
|
2239
2239
|
|
2240
2240
|
### Canvas Animation DSL
|
2241
2241
|
|
2242
|
-
**(ALPHA FEATURE)**
|
2242
|
+
**(EXPERIMENTAL EARLY ALPHA FEATURE)**
|
2243
2243
|
|
2244
2244
|
(note: this is a very new feature of Glimmer. It may change a bit while getting battle tested. As always, you could default to basic SWT usage if needed.)
|
2245
2245
|
|
@@ -2281,12 +2281,15 @@ Screenshot:
|
|
2281
2281
|
|
2282
2282
|
Keywords:
|
2283
2283
|
- `animation` declares an animation under a canvas, which renders frames using a frame block indefinitely or finitely depending on (cycle_count/frame_count) properties
|
2284
|
-
- `every` specifies delay in seconds between every two frame renders
|
2284
|
+
- `every` specifies delay in seconds between every two frame renders (an alternative to `fps`, cannot use together)
|
2285
|
+
- `fps` (alias: `frame_rate`) specifies frame rate as frames per second (an alternative to `every`, cannot use together)
|
2285
2286
|
- `frame {|index, cycle_var| }` a block that can contain Shape DSL syntax that is rendered dynamically with variables calculated on the fly
|
2286
2287
|
- `cycle` an optional property that takes an array to cycle into a second variable for the `frame` block
|
2287
|
-
- `cycle_count` an optional cycle count limit after which the animation stops
|
2288
|
-
- `frame_count` an optional frame count limit after which the animation stops
|
2289
|
-
- `
|
2288
|
+
- `cycle_count` an optional cycle count limit after which the animation stops (finishes)
|
2289
|
+
- `frame_count` an optional frame count limit after which the animation stops (finishes)
|
2290
|
+
- `duration_limit` an optional duration limit in seconds after which the animation stops (finishes)
|
2291
|
+
- `started`/`started?` a boolean indicating if the animation is started right away or stopped waiting for manual startup via `#start` method
|
2292
|
+
- `finished`/`finished?` a boolean indicating if the animation finished (for finite animations only)
|
2290
2293
|
|
2291
2294
|
API of Animation Object (returned from `animation` keyword):
|
2292
2295
|
- `#start` starts an animation that is indefinite or has never been started before (i.e. having `started: false` option). Otherwise, resumes a stopped animation that has not been completed.
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -31,7 +31,10 @@ module Glimmer
|
|
31
31
|
include ParentExpression
|
32
32
|
|
33
33
|
def can_interpret?(parent, keyword, *args, &block)
|
34
|
-
|
34
|
+
(
|
35
|
+
keyword == 'multiply' or
|
36
|
+
keyword == 'multiplication'
|
37
|
+
) and
|
35
38
|
parent.is_a?(Glimmer::SWT::TransformProxy)
|
36
39
|
end
|
37
40
|
|
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
require 'glimmer/swt/properties'
|
23
23
|
require 'glimmer/swt/custom/shape'
|
24
|
+
require 'bigdecimal'
|
24
25
|
|
25
26
|
module Glimmer
|
26
27
|
module SWT
|
@@ -79,10 +80,12 @@ module Glimmer
|
|
79
80
|
end
|
80
81
|
|
81
82
|
attr_reader :parent, :options
|
82
|
-
attr_accessor :frame_index, :cycle, :frame_block, :every, :cycle_count, :frame_count, :started, :duration_limit, :duration, :finished, :cycle_count_index
|
83
|
+
attr_accessor :frame_index, :cycle, :frame_block, :every, :fps, :cycle_count, :frame_count, :started, :duration_limit, :duration, :finished, :cycle_count_index
|
83
84
|
alias current_frame_index frame_index
|
84
85
|
alias started? started
|
85
86
|
alias finished? finished
|
87
|
+
alias frame_rate fps
|
88
|
+
alias frame_rate= fps=
|
86
89
|
# TODO consider supporting an async: false option
|
87
90
|
|
88
91
|
def initialize(parent)
|
@@ -114,6 +117,7 @@ module Glimmer
|
|
114
117
|
return if @start_number > 0 && started?
|
115
118
|
@start_number += 1
|
116
119
|
@start_time = Time.now
|
120
|
+
@duration = 0
|
117
121
|
@original_start_time = @start_time if @duration.nil?
|
118
122
|
self.finished = false if finished?
|
119
123
|
self.started = true
|
@@ -141,8 +145,8 @@ module Glimmer
|
|
141
145
|
|
142
146
|
# Restarts an animation (whether indefinite or not and whether stopped or not)
|
143
147
|
def restart
|
144
|
-
@original_start_time = @start_time =
|
145
|
-
self.duration =
|
148
|
+
@original_start_time = @start_time = Time.now
|
149
|
+
self.duration = 0
|
146
150
|
self.frame_index = 0
|
147
151
|
self.cycle_count_index = 0
|
148
152
|
stop
|
@@ -189,16 +193,19 @@ module Glimmer
|
|
189
193
|
def cycle_count_index=(value)
|
190
194
|
@cycle_count_index = value
|
191
195
|
self.finished = true if cycle_limited? && @cycle_count_index == @cycle_count
|
196
|
+
@cycle_count_index
|
192
197
|
end
|
193
198
|
|
194
199
|
def frame_index=(value)
|
195
200
|
@frame_index = value
|
196
201
|
self.finished = true if frame_count_limited? && @frame_index == @frame_count
|
202
|
+
@frame_index
|
197
203
|
end
|
198
204
|
|
199
205
|
def duration=(value)
|
200
206
|
@duration = value
|
201
207
|
self.finished = true if surpassed_duration_limit?
|
208
|
+
@duration
|
202
209
|
end
|
203
210
|
|
204
211
|
def cycle_enabled?
|
@@ -210,7 +217,7 @@ module Glimmer
|
|
210
217
|
end
|
211
218
|
|
212
219
|
def duration_limited?
|
213
|
-
@duration_limit.is_a?(
|
220
|
+
@duration_limit.is_a?(Numeric) && @duration_limit > 0
|
214
221
|
end
|
215
222
|
|
216
223
|
def frame_count_limited?
|
@@ -218,7 +225,7 @@ module Glimmer
|
|
218
225
|
end
|
219
226
|
|
220
227
|
def surpassed_duration_limit?
|
221
|
-
duration_limited? && ((Time.now - @start_time) >
|
228
|
+
duration_limited? && ((Time.now - @start_time) > @duration_limit)
|
222
229
|
end
|
223
230
|
|
224
231
|
def within_duration_limit?
|
@@ -234,6 +241,7 @@ module Glimmer
|
|
234
241
|
(frame_count_limited? && @frame_index == @frame_count) or
|
235
242
|
(cycle_limited? && @cycle_count_index == @cycle_count) or
|
236
243
|
surpassed_duration_limit?
|
244
|
+
self.duration = Time.now - @start_time
|
237
245
|
return false
|
238
246
|
end
|
239
247
|
block_args = [@frame_index]
|
@@ -241,6 +249,7 @@ module Glimmer
|
|
241
249
|
current_frame_index = @frame_index
|
242
250
|
current_cycle_count_index = @cycle_count_index
|
243
251
|
self.class.schedule_frame_animation(self) do
|
252
|
+
self.duration = Time.now - @start_time # TODO should this be set here, after the if statement, in the else too, or outside both?
|
244
253
|
if started? && start_number == @start_number && within_duration_limit?
|
245
254
|
unless @parent.isDisposed
|
246
255
|
@shapes.to_a.each(&:dispose)
|
@@ -249,9 +258,9 @@ module Glimmer
|
|
249
258
|
frame_block.call(*block_args)
|
250
259
|
}
|
251
260
|
@shapes = @parent.shapes - parent_shapes_before
|
261
|
+
self.duration = Time.now - @start_time # TODO consider if this is needed
|
252
262
|
end
|
253
263
|
else
|
254
|
-
self.finished = true if surpassed_duration_limit?
|
255
264
|
if stopped? && @frame_index > current_frame_index
|
256
265
|
self.frame_index = current_frame_index
|
257
266
|
self.cycle_count_index = current_cycle_count_index
|
@@ -260,7 +269,12 @@ module Glimmer
|
|
260
269
|
end
|
261
270
|
self.frame_index += 1
|
262
271
|
self.cycle_count_index += 1 if cycle_limited? && (@frame_index % @cycle&.length&.to_i) == 0
|
263
|
-
|
272
|
+
# TODO consider using timer_exec as a perhaps more reliable alternative
|
273
|
+
if every.is_a?(Numeric) && every > 0
|
274
|
+
sleep(every)
|
275
|
+
elsif fps.is_a?(Numeric) && fps > 0
|
276
|
+
sleep((BigDecimal(1.0.to_s) / BigDecimal(fps.to_f.to_s)).to_f)
|
277
|
+
end
|
264
278
|
true
|
265
279
|
rescue => e
|
266
280
|
Glimmer::Config.logger.error {e}
|
@@ -71,14 +71,14 @@ module Glimmer
|
|
71
71
|
# Logical x coordinate relative to parent
|
72
72
|
def x
|
73
73
|
x_value = bounds.x
|
74
|
-
x_value -= parent.absolute_x if parent.is_a?(Shape)
|
74
|
+
x_value -= parent.absolute_x if parent.is_a?(Shape) && parent.class != Shape
|
75
75
|
x_value
|
76
76
|
end
|
77
77
|
|
78
78
|
# Logical y coordinate relative to parent
|
79
79
|
def y
|
80
80
|
y_value = bounds.y
|
81
|
-
y_value -= parent.absolute_y if parent.is_a?(Shape)
|
81
|
+
y_value -= parent.absolute_y if parent.is_a?(Shape) && parent.class != Shape
|
82
82
|
y_value
|
83
83
|
end
|
84
84
|
|
@@ -91,7 +91,7 @@ module Glimmer
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def absolute_x1
|
94
|
-
if parent.is_a?(Shape)
|
94
|
+
if parent.is_a?(Shape) && parent.class != Shape
|
95
95
|
parent.absolute_x + x1
|
96
96
|
else
|
97
97
|
x1
|
@@ -99,7 +99,7 @@ module Glimmer
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def absolute_y1
|
102
|
-
if parent.is_a?(Shape)
|
102
|
+
if parent.is_a?(Shape) && parent.class != Shape
|
103
103
|
parent.absolute_y + y1
|
104
104
|
else
|
105
105
|
y1
|
@@ -107,7 +107,7 @@ module Glimmer
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def absolute_x2
|
110
|
-
if parent.is_a?(Shape)
|
110
|
+
if parent.is_a?(Shape) && parent.class != Shape
|
111
111
|
parent.absolute_x + x2.to_f
|
112
112
|
else
|
113
113
|
x2
|
@@ -115,7 +115,7 @@ module Glimmer
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def absolute_y2
|
118
|
-
if parent.is_a?(Shape)
|
118
|
+
if parent.is_a?(Shape) && parent.class != Shape
|
119
119
|
parent.absolute_y + y2.to_f
|
120
120
|
else
|
121
121
|
y2
|
@@ -34,6 +34,12 @@ module Glimmer
|
|
34
34
|
include_package 'org.eclipse.swt.graphics'
|
35
35
|
include_package 'org.eclipse.swt.widgets'
|
36
36
|
|
37
|
+
ATTRIBUTE_ALIASES = {
|
38
|
+
'rotation' => 'rotate',
|
39
|
+
'translation' => 'translate',
|
40
|
+
'inversion' => 'invert',
|
41
|
+
}
|
42
|
+
|
37
43
|
attr_reader :swt_transform, :parent
|
38
44
|
|
39
45
|
def initialize(parent, *args, swt_transform: nil, multiply: false)
|
@@ -81,10 +87,11 @@ module Glimmer
|
|
81
87
|
end
|
82
88
|
|
83
89
|
def has_attribute?(attribute_name, *args)
|
84
|
-
Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.respond_to?(attribute_name) } || super
|
90
|
+
ATTRIBUTE_ALIASES.keys.include?(attribute_name.to_s) || Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.respond_to?(attribute_name) } || super
|
85
91
|
end
|
86
92
|
|
87
93
|
def set_attribute(attribute_name, *args)
|
94
|
+
attribute_name = ATTRIBUTE_ALIASES[attribute_name.to_s] || attribute_name
|
88
95
|
if @swt_transform.respond_to?(attribute_name)
|
89
96
|
Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.send(attribute_name, *args) }
|
90
97
|
else
|
@@ -92,6 +99,11 @@ module Glimmer
|
|
92
99
|
end
|
93
100
|
end
|
94
101
|
|
102
|
+
def get_attribute(attribute_name)
|
103
|
+
attribute_name = ATTRIBUTE_ALIASES[attribute_name.to_s] || attribute_name
|
104
|
+
super(attribute_name)
|
105
|
+
end
|
106
|
+
|
95
107
|
def method_missing(method_name, *args, &block)
|
96
108
|
result = Glimmer::SWT::DisplayProxy.instance.auto_exec { @swt_transform.send(method_name, *args, &block) }
|
97
109
|
result.nil? ? self : result
|
@@ -25,12 +25,13 @@ require 'bigdecimal'
|
|
25
25
|
class HelloCanvasAnimation
|
26
26
|
include Glimmer::UI::CustomShell
|
27
27
|
|
28
|
-
|
29
|
-
attr_accessor :animation_every, :animation_frame_count, :animation_started, :animation_finished
|
28
|
+
attr_accessor :animation_every, :animation_fps, :animation_frame_count, :animation_duration_limit, :animation_started, :animation_finished
|
30
29
|
|
31
30
|
before_body {
|
32
|
-
@animation_every = 0.050
|
31
|
+
@animation_every = 0.050 # seconds
|
32
|
+
@animation_fps = 0
|
33
33
|
@animation_frame_count = 100
|
34
|
+
@animation_duration_limit = 0 # seconds
|
34
35
|
@animation_started = true
|
35
36
|
@animation_finished = false
|
36
37
|
}
|
@@ -40,6 +41,7 @@ class HelloCanvasAnimation
|
|
40
41
|
grid_layout(2, true)
|
41
42
|
text 'Hello, Canvas Animation!'
|
42
43
|
|
44
|
+
# row 1
|
43
45
|
button {
|
44
46
|
layout_data(:fill, :center, true, false)
|
45
47
|
text <= [self, :animation_started, on_read: ->(value) { value ? 'Stop' : 'Resume' }]
|
@@ -61,25 +63,51 @@ class HelloCanvasAnimation
|
|
61
63
|
@animation.restart
|
62
64
|
end
|
63
65
|
}
|
66
|
+
|
67
|
+
# row 2
|
64
68
|
label {
|
65
|
-
text 'every
|
69
|
+
text 'every'
|
66
70
|
}
|
67
71
|
label {
|
68
|
-
text '
|
72
|
+
text 'frames per second'
|
69
73
|
}
|
74
|
+
|
75
|
+
# row 3
|
70
76
|
spinner {
|
71
77
|
layout_data(:fill, :center, true, false)
|
72
78
|
digits 3
|
73
|
-
minimum
|
79
|
+
minimum 0
|
74
80
|
maximum 100
|
75
81
|
selection <=> [self, :animation_every, on_read: ->(v) {(BigDecimal(v.to_s)*1000).to_f}, on_write: ->(v) {(BigDecimal(v.to_s)/1000).to_f}]
|
76
82
|
}
|
83
|
+
spinner {
|
84
|
+
layout_data(:fill, :center, true, false)
|
85
|
+
minimum 0
|
86
|
+
maximum 100
|
87
|
+
selection <=> [self, :animation_fps]
|
88
|
+
}
|
89
|
+
|
90
|
+
# row 4
|
91
|
+
label {
|
92
|
+
text 'frame count (0=unlimited)'
|
93
|
+
}
|
94
|
+
label {
|
95
|
+
text 'duration limit (0=unlimited)'
|
96
|
+
}
|
97
|
+
|
98
|
+
# row 5
|
77
99
|
spinner {
|
78
100
|
layout_data(:fill, :center, true, false)
|
79
101
|
minimum 0
|
80
102
|
maximum 100
|
81
103
|
selection <=> [self, :animation_frame_count]
|
82
104
|
}
|
105
|
+
spinner {
|
106
|
+
layout_data(:fill, :center, true, false)
|
107
|
+
minimum 0
|
108
|
+
maximum 10
|
109
|
+
selection <=> [self, :animation_duration_limit]
|
110
|
+
}
|
83
111
|
|
84
112
|
canvas {
|
85
113
|
layout_data(:fill, :fill, true, true) {
|
@@ -88,10 +116,12 @@ class HelloCanvasAnimation
|
|
88
116
|
height_hint 320
|
89
117
|
}
|
90
118
|
@animation = animation {
|
91
|
-
every
|
92
|
-
|
93
|
-
|
94
|
-
|
119
|
+
every <= [self, :animation_every]
|
120
|
+
fps <= [self, :animation_fps]
|
121
|
+
frame_count <= [self, :animation_frame_count]
|
122
|
+
duration_limit <= [self, :animation_duration_limit]
|
123
|
+
started <=> [self, :animation_started]
|
124
|
+
finished <=> [self, :animation_finished]
|
95
125
|
|
96
126
|
frame { |index|
|
97
127
|
background rgb(index%100, index%100 + 100, index%55 + 200)
|
@@ -103,6 +133,16 @@ class HelloCanvasAnimation
|
|
103
133
|
}
|
104
134
|
}
|
105
135
|
}
|
136
|
+
|
137
|
+
def animation_every=(value)
|
138
|
+
@animation_every = value
|
139
|
+
self.animation_fps = 0 if @animation_every.to_f > 0
|
140
|
+
end
|
141
|
+
|
142
|
+
def animation_fps=(value)
|
143
|
+
@animation_fps = value
|
144
|
+
self.animation_every = 0 if @animation_fps.to_f > 0
|
145
|
+
end
|
106
146
|
end
|
107
147
|
|
108
148
|
HelloCanvasAnimation.launch
|
@@ -13,28 +13,29 @@ shell {
|
|
13
13
|
|
14
14
|
image(glimmer_logo, 0, 0) {
|
15
15
|
transform {
|
16
|
-
|
17
|
-
|
16
|
+
translation 110, 110
|
17
|
+
rotation 90
|
18
18
|
scale 0.21, 0.21
|
19
|
+
# also supports inversion, identity, shear, and multiplication {transform properties}
|
19
20
|
}
|
20
21
|
}
|
21
22
|
image(glimmer_logo, 0, 0) {
|
22
23
|
transform {
|
23
|
-
|
24
|
+
translation 110, 220
|
24
25
|
scale 0.21, 0.21
|
25
26
|
}
|
26
27
|
}
|
27
28
|
image(glimmer_logo, 0, 0) {
|
28
29
|
transform {
|
29
|
-
|
30
|
-
|
30
|
+
translation 220, 220
|
31
|
+
rotation 270
|
31
32
|
scale 0.21, 0.21
|
32
33
|
}
|
33
34
|
}
|
34
35
|
image(glimmer_logo, 0, 0) {
|
35
36
|
transform {
|
36
|
-
|
37
|
-
|
37
|
+
translation 220, 110
|
38
|
+
rotation 180
|
38
39
|
scale 0.21, 0.21
|
39
40
|
}
|
40
41
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.20.
|
4
|
+
version: 4.20.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
requirements:
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
72
|
+
version: 0.13.0
|
73
73
|
- - "<"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.0.0
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
83
|
+
version: 0.13.0
|
84
84
|
- - "<"
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: 2.0.0
|