敷き詰める

You can view and edit template source code, as well as checking its revision history.

Your request for the template deletion was cancelled.

Your request for the template deletion is accepted.

Live preview

Created dateTemplate title
Created dateTitle

No videos using this template has been created yet.

Source code

Please refer to Template API documents when writing code.

function Tile() {this.insomnia=true; this.name = "敷き詰める"; this.type = PUBLIC | PHRASE; // assignable to phrases, public var kc = require("KaraokeColor"); var karaokeColor = null; // @ui Slider(1, 20) // @title 敷き詰めるフレーズ数 this.numPhrases = 5; // @ui Slider(0, 19) // @title このフレーズの位置 this.index = 0; // @ui Slider(-20, 20) // @title オフセット(X) this.offsetX = 0; // @ui Slider(-20, 20) // @title オフセット(Y) this.offsetY = 0; // @ui Slider(-16, 16) // @title 文字間隔 this.letterSpacing = 0; // @ui Slider(-16, 16) // @title 行間隔 this.lineSpacing = 0; // @ui Slider(0, 10) // @title マージン this.margin = 0; // @ui Slider(0, 1000) // @title 表示開始時刻の調整 this.fadeIn = 300; // @ui Slider(0, 3000) // @title 表示終了時刻の調整 this.fadeOut = 800; // @ui Color() // @title 強調色 this.highlightColor = new Color('#ff0000'); this.animate = function(now) { var u = this.getAssignedUnit(); this.tile(u, now, this.index, this.numPhrases); }; this.tile = function(p, now, index, num) { if (karaokeColor === null) karaokeColor = new kc(); karaokeColor.highlightColor = this.highlightColor; // 表示終了時刻を計算する var last = p, i = index; for (; i + 1 < num; i ++) { if (last.next === null) break; last = last.next; } var endTime = last.endTime; if (now > endTime + this.fadeOut) { p.rendering.visible = false; return; } // 表示開始時刻を計算する p.rendering.visible = true; var start = p, charCount = p.charCount; for (i = 0; i < index; i ++) { if (start.previous === null) break; start = start.previous; charCount += start.charCount; } var startTime = start.startTime; var c = start.firstChar; var x = this.offsetX * width / 100 + this.margin * width / 100 , y = this.offsetY * height / 100 + this.margin * width / 100 , h = 0; for (var ci = 0; ci < charCount; ci++) { if (x + c.advance > width - this.margin * width / 100) { x = this.offsetX * width / 100 + this.margin * width / 100; y += h + this.lineSpacing * height / 100; h = 0; } if (ci >= charCount - p.charCount) { if (now < c.startTime - this.fadeIn) { c.rendering.visible = false; } else { karaokeColor.highlight(c, now); var progress; if (now < c.startTime) { progress = Math.sin((now + this.fadeIn - c.startTime) * Math.PI / 2 / this.fadeIn); c.rendering.alpha = progress; c.rendering.tx.translate(x + c.advance / 2, y + c.height / 2); c.rendering.tx.scale(progress, progress); c.rendering.tx.translate(- c.advance / 2, - c.height / 2); } else if (now > endTime) { progress = (endTime + this.fadeOut - now) / this.fadeOut; c.rendering.alpha = progress * karaokeColor.opacity / 100; c.rendering.tx.translate(x, y); } else { c.rendering.tx.translate(x, y); } } } x += c.advance + this.letterSpacing * height / 100; h = Math.max(c.height, h); c = c.next; } }; }

Copyright (c) 2015 mamerico. This software is released under the MIT License. When you submit your code to this website (TextAlive), it is regarded that you agree to distribute the code under the same license.

The author name comes from the login account if you are logged in. Otherwise, your name will be displayed as 'Anonymous'.

emnor、あいうえおかがきぎくけこさしじすせそぞただちっつてでとどなにねのはべほまみむもゃょよらりるれろわをんアィイエオキケコサジスズッテデトドナノハバピモャヨリルンー丸人付任似供僕入出効取合君四地変夜子学寝尽幅待得思悩想意愛手持描教日時更服未来校欲歩毎気汚深特猫球生疲白真眠着空繰羽育背色薬行街角誕誰足跡踊転迎返迷過道違隣雪飛駆?