Foros: 要望、感想など (Thread #29393)

エクスプレッションについて (2011-05-23 00:40 by Anónimo #57616)

JavaScriptやエクスプレッションについてはまったくの初心者です。
そこで以下の動画、

http://www.nicovideo.jp/watch/sm10419231

を見てカメラ制御を自分なりに勉強しようとしていました。
しかし、動画のようにエクスプレッション文を"cameraControl”レイヤーの位置情報のところに記述しても、
動画の8:25~8:31秒のような感じでカメラが動かず、またJavieがフリーズ→強制終了したりしてうまくいきません。

素人ながらにLinear関数やEase関数が使えないのかな?と思っているんですが、どうなんでしょうか?
エラーコンソールを見てもちんぷんかんぷんで・・・浅学ですみません。
以下にそのとき使用した位置情報のエクスプレッション文を書きます。ほぼこの動画で紹介されている文と一緒です。


cc=thisComp.layer("cameraControl").effect("targetControl")("スライダ");
num=Math.floor(cc);
nxtNum=num+1;

start=thisComp.layer("cameraControl").effect("Target-"+num)("レイヤー").position;
end=thisComp.layereffect("Target-"+nxtNum)("レイヤー").position;

if(thisComp.layer("cameraControl").effect("ease")("チェックボックス")==0){
linear(cc,num,nxtNum,start,end);}
else{
ease(cc,num,nxtNum,start,end);}


本当に初心者なので、間抜けなことを聞いているかもしれませんが、よろしくお願いします。

Responder al #57616×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Entrar

RE: エクスプレッションについて (2011-05-23 01:16 by Anónimo #57618)

すいません自己解決しました。コンソール文をもう一回見直したのですが、

org.mozilla.javascript.EcmaError: ReferenceError: "linear" is not defined. (#1)

の一文がありましたので、Linear関数が定義されてないみたいですね。
今後の実装に期待します。
Responder al #57616

Responder al #57618×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Entrar

RE: エクスプレッションについて (2011-05-29 03:47 by rakusan #57722)

linear関数やease関数はまだ実装されていませんが、
例えば次のような関数をエクスプレッションの冒頭に書くと、
そのエクスプレッション内で使用することができるようになります。

function linear(t, tMin, tMax, value1, value2)
{
if (t <= tMin) return value1;
if (t >= tMax) return value2;
return value1 + (value2-value1)*(t-tMin)/(tMax-tMin);
}

function ease(t, tMin, tMax, value1, value2)
{
if (t <= tMin) return value1;
if (t >= tMax) return value2;
t = (t-tMin)/(tMax-tMin);
t = 3*t*t - 2*t*t*t;
return value1 + (value2-value1) * t;
}
Responder al #57618

Responder al #57722×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Entrar

RE: エクスプレッションについて (2011-05-30 15:56 by Anónimo #57755)

Twitterでも返信させていただきましたがご回答ありがとうございます!関数の文まで書いてもらって多謝です。
もっと勉強して自分で関数も書けるように努力します。
ありがとうございました!
Responder al #57722

Responder al #57755×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Entrar

RE: エクスプレッションについて (2012-08-15 12:09 by chiba #65083)

自分もこのエクスプレッションを試してみたのですが、うまく行きません
エラーっぽいエラーも
org.mozilla.javascript.EvaluatorException: Cannot convert undefined to double
この位しか自分には見分けがつかず・・・・

↓この通りに入力したのですが・・・
function linear(t, tMin, tMax, value1, value2)
{
if (t <= tMin) return value1;
if (t >= tMax) return value2;
return value1 + (value2-value1)*(t-tMin)/(tMax-tMin);
}

function ease(t, tMin, tMax, value1, value2)
{
if (t <= tMin) return value1;
if (t >= tMax) return value2;
t = (t-tMin)/(tMax-tMin);
t = 3*t*t - 2*t*t*t;
return value1 + (value2-value1) * t;
}
cc=thisComp.layer("cameraControl").effect("targetControl")("スライダ");
num=Math.floor(cc);
nxtNum=num+1;

start=thisComp.layer("cameraControl").effect("Target-"+num)("レイヤー").position;
end=thisComp.layereffect("Target-"+nxtNum)("レイヤー").position;

if(thisComp.layer("cameraControl").effect("ease")("チェックボックス")==0){
linear(cc,num,nxtNum,start,end);}
else{
ease(cc,num,nxtNum,start,end);}

何が原因か教えていただければ嬉しいです
Responder al #57616

Responder al #65083×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Entrar

RE: エクスプレッションについて (2012-08-19 19:55 by rakusan #65131)

まず確認ですが、元のエクスプレッションはAfterEffects用だということはご理解頂けていますよね。

AfterEffectsとJavieのエクスプレッションは、記述方法はよく似ていますが、
全く同じものがそのまま動くというわけではありません。
簡単なものでは動く場合もありますが、ほとんどの場合Javie用に調整する必要があります。

ですので、エクスプレッションについてよく理解されないまま、
ただ「この通りに入力した」というだけで使用するのは難しいと思います。

今回のエクスプレッションですと、
cc=thisComp.layer("cameraControl").effect("targetControl")("スライダ");
のところは、たぶん次のようにする必要があります。
cc=thisComp.layer("cameraControl").effect("targetControl").slider;
(元の動画を見ていないので間違っているかもしれません)’

また、他にも直すべき箇所がいくつかあると思います。


なお、現在はlinear関数とease関数は実装済みです。
http://sourceforge.jp/projects/javie/wiki/%E3%82%A8%E3%82%AF%E3%82%B9%E3%83%97%E3%83%AC%E3%83%83%E3%82%B7%E3%83%A7%E3%83%B3
Responder al #57616

Responder al #65131×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Entrar

RE: エクスプレッションについて (2012-08-22 14:22 by chiba #65197)

ありがとうございます
もう少し勉強してみます
Responder al #57616

Responder al #65197×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Entrar