tsuku 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4370250d025ae2ac4b02f53c828cc682a727305c35ebf72e509c56748dad7bd6
4
- data.tar.gz: 1617da726ec90a1359bb54f69844553c6950b7212efd4e9c85828209df4c0e5b
3
+ metadata.gz: 9516ac9925e8dd226c61dd259a5530ccaf673243adf7a94b715b06073ca11fb9
4
+ data.tar.gz: c2475cc2585bf75d79468f4c9b0d16bccc0e52792251a154df821e08dfffb208
5
5
  SHA512:
6
- metadata.gz: a0aafdcd8330b80720cea1357a9eb48ceee2ea5827697ac19f1bf48d31553fa8b99799527c2c69dca721ad532a51fcfc9584b0c9ea87f820cbdcc6f6bd20803e
7
- data.tar.gz: 62f7732f0df2850f2fd7504f674bf85e5ffc57b447d0826e063e4b252aeb22e740d9ba39bf948390bc7e1de49a35b9896a541db9fff573cd9068d8d4bc6954b6
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
@@ -1,3 +1,7 @@
1
+ # 0.2.0
2
+
3
+ * Add ability to delete tween from Tweener
4
+
1
5
  # 0.1.2
2
6
 
3
7
  * Tweener.add_tween returns the created tween
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tsuku (0.1.0)
4
+ tsuku (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Tsuku
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,22 +1,27 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Tsuku::Tweener do
4
- let(:target) { MockTarget.new(x: 1, y: 2, z: 3) }
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(1000)
13
- expect(target.x).to eq(10)
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(1)
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.1.2
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-25 00:00:00.000000000 Z
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.1
115
+ rubygems_version: 3.0.6
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: A tweening library made with Ruby