1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2013-09-10

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;
  }
};
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?