回って拡大/背景付き

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 RotateAndZoomWithBackground() { this.name = "回って拡大/背景付き"; this.type = PHRASE; var da = require("DefaultAlignment"); var defaultAlignment = null; // @ui Slider(0, 100) // @title 回転スピード this.rotSpeed = 20; // @ui Slider(1, 1000) // @title 開始時刻補正 this.headTime = 300; // @ui Slider(1, 1000) // @title 終了時刻補正 this.tailTime = 500; // @ui Slider(-200, 200) // @title 横位置補正 this.x = 0; // @ui Color() // @title 背景色 this.primaryColor = new Color('#186f7f'); // @ui Color() // @title 文字色 this.textColor = new Color('#ffffff'); // @ui Slider(-100, 100) // @title 背景縦位置 this.yFix = 15; this.animate = function(now) { if (defaultAlignment === null) { defaultAlignment = new da(); } // 発声されていなければ何もしない var p = this.getAssignedUnit(); if (p.startTime - this.headTime > now || p.endTime + this.tailTime < now) { p.rendering.visible = false; return; } // まずは普通に並べる defaultAlignment.tailTime = this.tailTime; defaultAlignment.align(p, now, false, false); p.rendering.tx.translate(this.x, 0); // 進捗を確認する var progress = (now - p.startTime) / (p.endTime - p.startTime), scale = Math.E/Math.exp(progress); // 色・大きさ・傾き・透明度を調整する p.color = this.textColor; p.rendering.tx.scale(scale, scale); p.rendering.tx.rotate(progress*this.rotSpeed); if (progress < 0) { p.rendering.alpha = 1 - (p.startTime - now) / this.headTime; } else if (progress > 1) { p.rendering.alpha = 1 - (now - p.endTime) / this.tailTime; } // 背景として塗るべき範囲を計算する var phraseWidth = p.advance + (p.wordCount - 1) * 5 , phraseHeight = p.height , advance = 0 , c = p.firstChar , w = p.firstWord , i; for (i = 0; i < p.charCount; i ++) { if (c.startTime > now) break; advance += c.advance; c = c.next; } for (i = 0; i < p.wordCount; i ++) { if (w.endTime > now) break; advance += 5; w = w.next; } // 背景を塗る this.primaryColor.a = 0.7 * 256; p.graphics .beginStroke(this.primaryColor.rgba) .setStrokeStyle(phraseHeight*1.4) .moveTo(-phraseWidth/2, phraseHeight/2 + this.yFix) .lineTo(-phraseWidth/2 + advance, phraseHeight/2 + this.yFix) .endStroke(); }; }

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