#!/usr/bin/env ruby require 'bundler/setup' require 'whirled_peas' require 'whirled_peas/animator/easing' module WhirledPeas NUM_POINTS = 60 Animator::Easing::EASING.keys.each do |func| Animator::Easing::EFFECTS.each do |effect| easing = Animator::Easing.new(func, effect) graph = Array.new(NUM_POINTS / ASPECT_RATIO) { '┃' } NUM_POINTS.times.each do |i| input = i.to_f / (NUM_POINTS - 1) eased_value = ((easing.ease(input) * NUM_POINTS * 2) / ASPECT_RATIO).floor graph.each.with_index do |row, row_num| y_value = NUM_POINTS.to_f / ASPECT_RATIO - row_num - 1 row << if eased_value == 2 * y_value '▄' elsif eased_value == 2 * y_value + 1 '▀' else ' ' end end end graph << '┗' + '━' * NUM_POINTS puts "#{func} (#{effect})" puts graph.join("\n") end end end