Skip to content

owenbutler/dr-text-effects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dr-text-effects

Small library and example code to create text effects in DragonRuby

Installation

Preferred install is via DragonRuby builtin download_stb_rb

First, download the lib using the above method, in the DragonRuby Console:

$gtk.download_stb_rb "https://github.com/owenbutler/dr-text-effects/blob/main/app/text_effect.rb"

By default, this will download the lib to owenbutler/dr-text-effects/text_effect.rb

Include the following in your main.rb:

require 'owenbutler/dr-text-effects/text_effect.rb'

For more control over where the lib is downloaded, see the docs for download_stb_rb

Usage

Minimal example:

require 'owenbutler/dr-text-effects/text_effect.rb'

def tick args

  if args.tick_count == 0
    args.state.wavy = WaveHorizontal.new( {
      x: 150, y: 300, text: "The quick brown fox", size_enum: 30,
    })
  end

  args.outputs.sprites << args.state.wavy.render
end

quick-brown

Effect Types

The following effects are supported:

  • WaveHorizontal
  • WaveVertical
  • SlideHorizontal
  • SlideVertical
example.mp4

The example code used to create the effects above can be found in main.rb

Autoplay

By default, slide effects will autoplay. If you'd rather control when things play, pass in autoplay: false and start the animation with .play!

require 'owenbutler/dr-text-effects/text_effect.rb'

def tick args

  if args.tick_count == 0
    args.state.slide = SlideHorizontal.new( {
      x: 150, y: 300, text: "The quick brown fox", size_enum: 30,
    }, autoplay: false )
  end

  args.outputs.sprites << args.state.slide.render

  if args.inputs.keyboard.key_up.p
    args.state.slide.play!
  end
end

About

Small library for creating text effects in DragonRuby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages