下部寄せ(カラオケ)拡散スター付き

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 BottomKaraokeWithSparkleUnderline() { this.name = "下部寄せ(カラオケ)拡散スター付き"; this.type = PUBLIC | PHRASE; // assignable to phrases, public var kc = require("KaraokeColor"); var kc_ = null; // @ui Slider(0, 100) // @title 下端からの距離[%] this.bottomOffset = 10; // @ui Slider(0, 20) // @title 文字間隔 this.letterSpacing = 0; // @ui Slider(-20, 20) // @title 落ちてくるスピード this.dropSpeed = 0; // @ui Slider(0, 200) // @title 拡大率 this.zoom = 100; // @ui Color() // @title 文字色 this.textColor = new Color('#000'); // @ui Color() // @title 強調色 this.highlightColor = new Color('#f00'); // @ui Slider(0, 100) // @title 透明度 this.textOpacity = 90; // @ui Slider(1, 20) // @title キラキラの数 this.stars = 5; // @ui Color() // @title キラキラの色 this.primaryColor = new Color('#ffc800'); // @ui Slider(1, 100) // @title 線の太さ this.strokeWidth = 3; // @ui Slider(0, 100) // @title キラキラの透明度 this.opacity = 20; // @ui Slider(0, 2000) // @title キラキラの速度(px/sec) this.timeToPx = 300; // @ui Slider(-100, 100) // @title キラキラの縦位置 this.starY = 0; // @ui Slider(-3000, 3000) // @title 開始時刻補正 this.headTime = 1000; // @ui Slider(-3000, 3000) // @title 終了時刻補正 this.tailTime = 1000; var stars = []; this.animate = function(now) { var p = this.getAssignedUnit(); this.align(p, now, true); }; // Hide text units if not vocalized. this.align = function(p, now, karaoke) { if (kc_ === null && karaoke === true) { kc_ = new kc(); } kc_.textColor = this.textColor; kc_.highlightColor = this.highlightColor; kc_.opacity = this.textOpacity; if (stars.length <= 0 || stars.length !== Math.floor(p.duration * this.stars / 1000)) { stars = []; for (var i = 0; i < Math.floor(p.duration * this.stars / 1000); i ++) { stars.push({ "t": i * 1000 / this.stars, "theta": Math.cos(Math.random() * Math.PI) * Math.PI }); } } if (p.startTime - this.headTime < now && p.endTime + this.tailTime > now) { p.rendering.visible = true; if (p.startTime > now) { p.rendering.alpha = (this.headTime - (p.startTime - now)) / this.headTime; } else if (p.endTime < now) { p.rendering.alpha = (this.tailTime - (now - p.endTime)) / this.tailTime; } // draw a star var x = width / 2 , y = height * (100 - this.bottomOffset) / 100 - p.height , cx = phraseWidth * (progress - 0.5) , sy = y + height * this.starY / 100 , phraseWidth = p.advance + (p.wordCount - 1) * 5 + (p.charCount - 1) * this.letterSpacing , elapsed = now - p.startTime , progress = elapsed / p.duration , r = 40 , brush = 'rgba(' + this.primaryColor.r + ', ' + this.primaryColor.g + ',' + this.primaryColor.b + ', ' + this.opacity * 0.01 + ')'; p.graphics .beginStroke(brush) .setStrokeStyle(this.strokeWidth) .drawPolyStar(cx, sy, r, 5, 0.4, 30 + elapsed * Math.PI / 10) .endStroke() .beginFill(brush); for (var i = 0; i < stars.length; i ++) { var star = stars[i]; var timeToPx = this.timeToPx * 0.001; if (star.t > elapsed) continue; p.graphics .drawPolyStar( Math.cos(star.theta) * (elapsed - star.t) * timeToPx + phraseWidth * (i / stars.length - 0.5) , Math.sin(star.theta) * (elapsed - star.t) * timeToPx + sy , r, 5, 0.4, 30 + elapsed * Math.PI / 10); } p.graphics .endFill(); // align phrase - show text at the bottom center. var tx = new Matrix2D(); tx.translate(x, y); tx.scale(this.zoom*0.01, this.zoom*0.01); p.rendering.tx = tx; // align words - show each word 5px right of the previous word. var word = p.firstWord; var offsetX = -phraseWidth / 2; for (var i = 0; i < p.wordCount; i++) { tx = new Matrix2D(); tx.translate(offsetX, 0); word.rendering.tx = tx; offsetX += word.advance + word.charCount * this.letterSpacing + 5; // align characters. var char = word.firstChar; var charOffsetX = 0; for (var j = 0; j < word.charCount; j++) { tx = new Matrix2D(); tx.translate( charOffsetX, Math.min( Math.min( 0, (now - char.startTime) * this.dropSpeed / 10 ), Math.max( 0, (now - char.startTime) * this.dropSpeed / 10))); char.rendering.tx = tx; charOffsetX += char.advance + this.letterSpacing; if (karaoke === true) { kc_.highlight(char, now); } char = char.next; } word = word.next; } return true; } else { p.rendering.visible = false; return false; } }; }

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