X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=lib%2Fredact%2Fprogram.rb;h=d6038d9646b82d17c75a499fa3e361d8d87884fa;hb=ab3172e24532a15d27284567efde3a6aff5672c8;hp=78f2ca960a3904912650ea32daa252979e99b9ad;hpb=7fd6ce732c4bb60fc3fa22f82a59c1f03be4809f;p=redact.git 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