tsuku 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +50 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/tsuku/tweener.rb +10 -0
- data/lib/tsuku/version.rb +1 -1
- data/spec/tweener_spec.rb +17 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9516ac9925e8dd226c61dd259a5530ccaf673243adf7a94b715b06073ca11fb9
|
4
|
+
data.tar.gz: c2475cc2585bf75d79468f4c9b0d16bccc0e52792251a154df821e08dfffb208
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd0c5556bbba8bf0879318118c2e4a3fa7a4907404afc0fc147342fd1ffd9b0eff328f7ff068c92c825c1b7161e6ed148ac26331a17be12bf5c9fd599e583d9e
|
7
|
+
data.tar.gz: 075e1ad0685d06629fc4d6f7d197fdf49494529a1a19b347c36486d2dbfe4ddddf7559f2c38b2aa2963922504a62e86f5e0cc1262d4848062ee1bd8bca4d735e
|
data/.gitignore
CHANGED
@@ -1,2 +1,52 @@
|
|
1
1
|
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
Gemfile.lock
|
46
|
+
.ruby-version
|
47
|
+
.ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
2
52
|
.rspec_status
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/tsuku/tweener.rb
CHANGED
@@ -21,6 +21,16 @@ module Tsuku
|
|
21
21
|
tween
|
22
22
|
end
|
23
23
|
|
24
|
+
def delete_tween(tween)
|
25
|
+
tween.pause
|
26
|
+
|
27
|
+
raise StandardError.new("Tween not found") unless @tweens.include?(tween)
|
28
|
+
|
29
|
+
@tweens.delete(tween)
|
30
|
+
|
31
|
+
@tweens
|
32
|
+
end
|
33
|
+
|
24
34
|
def step(delta_ms)
|
25
35
|
return if !@running
|
26
36
|
|
data/lib/tsuku/version.rb
CHANGED
data/spec/tweener_spec.rb
CHANGED
@@ -1,22 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe Tsuku::Tweener do
|
4
|
-
let(:target) { MockTarget.new(x:
|
4
|
+
let(:target) { MockTarget.new(x: 0, y: 0, z: 0) }
|
5
5
|
|
6
6
|
before do
|
7
7
|
Tsuku::Tweener.add_tween(target, { x: 10 }, 1000)
|
8
8
|
Tsuku::Tweener.add_tween(target, { y: 10 }, 2000)
|
9
9
|
end
|
10
|
+
|
11
|
+
it "returns added tween" do
|
12
|
+
expect(Tsuku::Tweener.add_tween(target, { x: 10 }, 1000)).
|
13
|
+
to be_a(Tsuku::Tween)
|
14
|
+
end
|
10
15
|
|
11
16
|
it "advances tweens correctly" do
|
12
|
-
Tsuku::Tweener.step(
|
13
|
-
expect(target.x).to eq(
|
17
|
+
Tsuku::Tweener.step(500)
|
18
|
+
expect(target.x).to eq(5)
|
14
19
|
end
|
15
20
|
|
16
21
|
it "does not advance tweens when paused" do
|
17
22
|
Tsuku::Tweener.pause
|
18
23
|
Tsuku::Tweener.step(1000)
|
19
|
-
expect(target.x).to eq(
|
24
|
+
expect(target.x).to eq(0)
|
20
25
|
end
|
21
26
|
|
22
27
|
it "advances tweens when paused and resumed" do
|
@@ -31,4 +36,12 @@ RSpec.describe Tsuku::Tweener do
|
|
31
36
|
Tsuku::Tweener.step(1000)
|
32
37
|
expect(target.y).to eq(10)
|
33
38
|
end
|
39
|
+
|
40
|
+
it "deletes tween correctly" do
|
41
|
+
tween = Tsuku::Tweener.add_tween(target, { z: 10 }, 2000)
|
42
|
+
Tsuku::Tweener.delete_tween(tween)
|
43
|
+
Tsuku::Tweener.step(1000)
|
44
|
+
|
45
|
+
expect(target.z).to eq(0)
|
46
|
+
end
|
34
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tsuku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Tuttle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
rubygems_version: 3.0.
|
115
|
+
rubygems_version: 3.0.6
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: A tweening library made with Ruby
|