Class: AnimateIt::FrameContext

Inherits:
Data
  • Object
show all
Defined in:
lib/animate_it/frame_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#compositionObject (readonly)

Returns the value of attribute composition

Returns:

  • (Object)

    the current value of composition



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def composition
  @composition
end

#duration_in_framesObject (readonly)

Returns the value of attribute duration_in_frames

Returns:

  • (Object)

    the current value of duration_in_frames



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def duration_in_frames
  @duration_in_frames
end

#fpsObject (readonly)

Returns the value of attribute fps

Returns:

  • (Object)

    the current value of fps



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def fps
  @fps
end

#frameObject (readonly)

Returns the value of attribute frame

Returns:

  • (Object)

    the current value of frame



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def frame
  @frame
end

#heightObject (readonly)

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def height
  @height
end

#local_frameObject (readonly)

Returns the value of attribute local_frame

Returns:

  • (Object)

    the current value of local_frame



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def local_frame
  @local_frame
end

#propsObject (readonly)

Returns the value of attribute props

Returns:

  • (Object)

    the current value of props



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def props
  @props
end

#segmentObject (readonly)

Returns the value of attribute segment

Returns:

  • (Object)

    the current value of segment



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def segment
  @segment
end

#widthObject (readonly)

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



2
3
4
# File 'lib/animate_it/frame_context.rb', line 2

def width
  @width
end

Instance Method Details

#interpolate(input, input_range, output_range) ⇒ Object



20
21
22
# File 'lib/animate_it/frame_context.rb', line 20

def interpolate(input, input_range, output_range, **)
  Timing.interpolate(input, input_range, output_range, **)
end

#progress(duration_frames: nil) ⇒ Object



13
14
15
16
17
18
# File 'lib/animate_it/frame_context.rb', line 13

def progress(duration_frames: nil)
  total = duration_frames || segment&.duration_frames || duration_in_frames
  return 0.0 if total.to_i <= 1

  local_frame.to_f / (total - 1)
end

#springObject



24
25
26
# File 'lib/animate_it/frame_context.rb', line 24

def spring(**)
  Timing.spring(frame: local_frame, fps:, **)
end