Class: Paggio::CSS::Animation

Inherits:
BasicObject
Defined in:
lib/paggio/css/animation.rb

Defined Under Namespace

Classes: Step

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Animation

Returns a new instance of Animation.



29
30
31
32
# File 'lib/paggio/css/animation.rb', line 29

def initialize(name)
  @name  = name
  @steps = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



49
50
51
# File 'lib/paggio/css/animation.rb', line 49

def method_missing(*args, &block)
  @steps.last.__send__(*args, &block)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/paggio/css/animation.rb', line 27

def name
  @name
end

#stepsObject (readonly)

Returns the value of attribute steps.



27
28
29
# File 'lib/paggio/css/animation.rb', line 27

def steps
  @steps
end

Instance Method Details

#from(value, &block) ⇒ Object



39
40
41
42
# File 'lib/paggio/css/animation.rb', line 39

def from(value, &block)
  @steps << Step.new(0.%)
  block.call
end

#step(value, &block) ⇒ Object



34
35
36
37
# File 'lib/paggio/css/animation.rb', line 34

def step(value, &block)
  @steps << Step.new(value)
  block.call
end

#to(value, &block) ⇒ Object



44
45
46
47
# File 'lib/paggio/css/animation.rb', line 44

def to(value, &block)
  @steps << Step.new(100.%)
  block.call
end