0
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

updated at

setValue()とsetValueAtTime()をまとめる

After EffectsスクリプトExtendScriptでsetValue()とsetValueAtTime()が分かれてるのがめんどうなので一つに。

setValueAtSmart.coffee
# キーフレームがすでに打たれているかの確認し場合によって値を実際に入れてゆく
Property::setValueAtSmart = (time, newValue) ->
  # プロパティがhiddenの場合に判別する手段がないため,tryで包む
  try
    if @numKeys is 0
      @setValue newValue
    else
      @setValueAtTime time, newValue
  catch err
    alert err

一応コンパイルしたのも

setValueAtSmart.js
// キーフレームがすでに打たれているかの確認し場合によって値を実際に入れてゆく
Property.prototype.setValueAtSmart = function(time, newValue) {
  var err;
  try {
    if (this.numKeys === 0) {
      return this.setValue(newValue);
    } else {
      return this.setValueAtTime(time, newValue);
    }
  } catch (_error) {
    err = _error;
  }
};
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
0
Help us understand the problem. What are the problem?