Sha256: 8ee089201ec13b4b4ad9e7a5c90726d73555e46a1c8de28213c65a2fb47760fe
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require "live2d/version" module Jekyll class RenderLive2D < Liquid::Tag def initialize(tag_name, text, tokens) @config = Jekyll.configuration({})['live2d'] if text.empty? if @config @width = @config['style']['width'] @height = @config['style']['height'] @position = @config['style']['position'] @top = @config['style']['top'] @bottom = @config['style']['bottom'] @left = @config['style']['left'] @right = @config['style']['right'] else @width = '150' @height = '150' @position = 'fixed' @top = '100' @bottom = '0' @left = '100' @right = '0' end else @width = text.split(",").first.strip @height = text.split(",").last.strip end super end def render(context) <<~HEREDOC <canvas id="glcanvas" style=" width: #{@width}px; height: #{@height}px; position: fixed; top: #{@top}; bottom: #{@bottom}; left: #{@left}; right: #{@right}; " > </canvas> <script type="text/javascript" src="/assets/javascripts/live2d.min.js"></script> <script type="text/javascript" src="/assets/javascripts/Simple.js"></script> <script type="text/javascript"> Simple(); </script> HEREDOC end end end Liquid::Template.register_tag('render_live2d', Jekyll::RenderLive2D)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
live2d-0.1.1 | lib/live2d.rb |