Sha256: 40c78f2f42855eea6049eb3068569534546e6f0a5a5c4efc37c4a691fc0527a6

Contents?: true

Size: 1.61 KB

Versions: 4

Compression:

Stored size: 1.61 KB

Contents

# --------- GEOMERATIVE EXAMPLES ---------------
# //////////////////////////////////////////////
# Title   :   TypoGeo_Deform
# Date    :   31/08/2011
# Version :   v0.5
#
# This sketch deforms the text using noise as the underlying
# algorithm. mouseX & mouseY movement will change the amount
# & intensity of the noise values.
# Key 'f' = Switches animation on/off
# Key '+'  & '-' = Changes the diameter of our ellipse.
#
# Licensed under GNU General Public License (GPL) version 3.
# http://www.gnu.org/licenses/gpl.html
#
# A series of tutorials for using the Geomerative Library
# developed by Ricard Marxer.
# http://www.ricardmarxer.com/geomerative/
#
# More info on these tutorials and workshops at :
# www.freeartbureau.org/blog
#
require 'geomerative'
load_library :font_agent

attr_reader :my_font, :my_group, :my_points, :my_text
attr_reader :my_agents, :step, :stop_anime

def settings
  size(800, 350)
  smooth
end

def setup
  sketch_title 'Bubbles'
  background(0)
  @step = 3
  @my_text = 'BUBBLES'
  RG.init(self)
  @my_font = RFont.new(data_path('FreeSans.ttf'), 113, CENTER)
  @stop_anime = false
  RCommand.setSegmentLength(10)
  RCommand.setSegmentator(RCommand::UNIFORMLENGTH)
  @my_points = my_font.toGroup(my_text).getPoints
  @my_agents = my_points.map { |point| FontAgent.new(location: Vec2D.new(point)) }
end

def draw
  translate(400, 205)
  background(0)
  fill(255)
  my_agents.each do |point|
    point.display(step: step)
    point.motion
  end
end

def key_pressed
  case key
  when 'f', 'F'
    @stop_anime = !stop_anime
    stop_anime ? no_loop : loop
  when '+'
    @step += 1
  when '-'
    @step -= 1
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geomerative-2.1.0-java examples/typo_deform.rb
geomerative-2.0.0-java examples/typo_deform.rb
geomerative-1.1.0-java examples/typo_deform.rb
geomerative-1.0.2-java examples/typo_deform.rb