From: Tilman Sauerbeck Date: Sat, 2 Apr 2005 23:20:32 +0000 (+0000) Subject: Use symbols instead of constants for tween modes. X-Git-Tag: redact-0.1.1~13 X-Git-Url: http://git.code-monkey.de/?p=redact.git;a=commitdiff_plain;h=ab3172e24532a15d27284567efde3a6aff5672c8 Use symbols instead of constants for tween modes. --- diff --git a/ChangeLog b/ChangeLog index 3e2af85..4e7302d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ -- -$Id: ChangeLog 22 2005-04-02 22:29:50Z tilman $ +$Id: ChangeLog 23 2005-04-02 23:20:32Z tilman $ ++ 2005-04-03 Tilman Sauerbeck (tilman at code-monkey de) @@ -9,6 +9,8 @@ $Id: ChangeLog 22 2005-04-02 22:29:50Z tilman $ * lib/redact/part.rb: Use symbols instead of constants for text effects * lib/redact/part.rb: Code cleanup + * lib/redact/program.rb: Use symbols instead of constants for + tween modes 2005-04-02 Tilman Sauerbeck (tilman at code-monkey de) * lib/redact/part.rb: Made 'step' and 'aspect' parameters diff --git a/lib/redact/program.rb b/lib/redact/program.rb index 78f2ca9..d6038d9 100644 --- a/lib/redact/program.rb +++ b/lib/redact/program.rb @@ -1,5 +1,5 @@ #-- -# $Id: program.rb 1 2005-03-26 01:32:38Z tilman $ +# $Id: program.rb 23 2005-04-02 23:20:32Z tilman $ # # Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) # @@ -73,11 +73,6 @@ module Redact end class SetStateProgram < Program - MODE_LINEAR = 1 - MODE_SINUSOIDAL = 2 - MODE_ACCELERATE = 3 - MODE_DECELERATE = 4 - attr_reader :targets attr_accessor :state, :value, :mode, :time @@ -87,16 +82,25 @@ module Redact @type = TYPE_SET_STATE @state = "default" @value = 0.0 - @mode = MODE_LINEAR + @mode = :linear @time = 0.0 @targets = ProgramArgs.new(collection) end def to_eet_properties + mode = case @mode + when :linear: 1 + when :sinusoidal: 2 + when :accelerate: 3 + when :decelerate: 4 + else + raise(RedactError, "invalid mode - #{@mode}") + end + super.merge!( {"state" => [@state], "value" => [@value, :double], - "tween.mode" => [@mode], + "tween.mode" => [mode], "tween.time" => [@time, :double], "targets" => [@targets]}) end