Sha256: 397837af4fe5992fa4f2283d65991137fe6d61670e2997925f17303c75ceaef9

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

describe Joybox::Actions::Bezier do
  behaves_like "Action Sprite"

  it "should move the sprite by bezier path" do
    @sprite.run_action Bezier.by bezier: [[100, 100], [50, 50], [-50, -50]]
    @sprite.position.should == CGPointMake(5, 5)

    wait 0.2 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.not.be.close 105, 0.1
      @sprite.position.y.should.not.be.close 105, 0.1
    end

    wait 0.5 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.be.close 105, 0.1
      @sprite.position.y.should.be.close 105, 0.1
    end
  end

  it "should move the sprite to bezier path" do
    @sprite.run_action Bezier.to bezier: [[100, 100], [50, 50], [-50, -50]]
    @sprite.position.should == CGPointMake(5, 5)

    wait 0.2 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.not.be.close 100, 0.1
      @sprite.position.y.should.not.be.close 100, 0.1
    end

    wait 0.5 do
      @sprite.position.should.not == CGPointMake(5, 5)
      @sprite.position.x.should.be.close 100, 0.1
      @sprite.position.y.should.be.close 100, 0.1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 spec/motion/joybox/actions/bezier_spec.rb
joybox-1.1.0 spec/motion/joybox/actions/bezier_spec.rb